Upload file size in browser side

Is there a way to detect the size of the attached file in the browser side, before to send this file to a servlet? If yes, how to?

Yes u can do that pls check this and let me know...
did it serve the purpose
<HTML>
<HEAD>
<SCRIPT>
function getImageDimension (imgURL, loadHandler) {
var img = new Image();
img.onload = loadHandler;
if (document.layers
&& location.protocol.toLowerCase() != 'file:'
&& navigator.javaEnabled())
netscape.security.PrivilegeManager.enablePrivilege(
'UniversalFileRead'
img.src = imgURL;
function getFileSize (fileName) {
if (document.layers) {
if (navigator.javaEnabled()) {
          alert('inside');
var file = new java.io.File(fileName);
if (location.protocol.toLowerCase() != 'file:')
netscape.security.PrivilegeManager.enablePrivilege(
'UniversalFileRead'
return file.length();
else return -1;
else if (document.all) {
window.oldOnError = window.onerror;
window.onerror = function (err) {
if (err.indexOf('utomation') != -1) {
alert('file access not possible');
return true;
else
return false;
var fso = new ActiveXObject('Scripting.FileSystemObject');
var file = fso.GetFile(fileName);
window.onerror = window.oldOnError;
return file.Size;
function showImageDimensions () {
alert(this.width + 'x' + this.height);
</SCRIPT>
<SCRIPT>
function checkImageDimensions (fileName) {
var imgURL = 'file:///' + fileName;
getImageDimension(imgURL, showImageDimensions);
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="formName">
<INPUT TYPE="file" NAME="fileName">
<BR>
<INPUT TYPE="button" VALUE="check file size"
ONCLICK="alert(getFileSize(this.form.fileName.value))"
>
<BR>
<INPUT TYPE="button" VALUE="check image dimensions"
ONCLICK="checkImageDimensions(this.form.fileName.value)"
>
</FORM>
</BODY>
</HTML>
--------------------------------

Similar Messages

  • How can we limit uploading file size in portal.

    we have a feature where customers can upload there files, we use portals for uploading files, form which has the file type is posted to a stored procedure and which in turns calls the wwv_things.saveitem.
    we need to restrict a file size and file type for the uploading files, I can restrict the file type with javasript but wanted to find out if oracle portals has any way to restrict the uploading file size,
    thanks and regards,
    Sunil.

    Currently, this is not available. You could have a query that has all RKF as a starting point to achieve this. If you think this would be good to have by default, please log a development request on the OSS Messaging System.

  • "the remote server returned an error (400) bad request." can't able to upload file size 1 MB

    I cant able to upload the file size >1 MB its showing error."the remote server returned an error (400) bad request."
    any one kindly help to fix the issue.

    Hi,
    Are you trying thru OOB or how..
    Please check the "maximum file size for sharepoint".
    refer below links for the same.
    https://angler.wordpress.com/2012/03/21/increase-the-sharepoint-2010-upload-file-size-limit/
    https://msdn.microsoft.com/en-us/library/ff487972.aspx
    Don't forget to mark it as an Answer if it resolves your problem or Vote Me if it useful.
    Mahesh

  • Upload File size limit when applying HTTPs on NES 4.0 SP1

    Hi,all
    I try to upload a file throgh a servlet,it works fine under HTTP,but when I apply Https protocol on my web application.The configuration is as fllowing:
    APP Server:WebLogic 5.1 SP 9
    Web Server:Netscape Enterprise Server 4.0 Sp1
    I found if the uploaded file size exceede 50K,the web server will encounter error and error message is as following:
    Unexpected Exception recieving data-5938
    I try to locate the problem,someone told me that the problem reside in Weblogic 5.1 plugin configuration,you should add somting in your obj.conf,but he neither figure out what the problem is.Anyone Help!!
    Any help and tips will be appricated
    cheng

    why not first try to upgrade to new versions of web server like 6.1 ? i don't think, sun officially supports 4.0 or 4.1 any more (at least 6 years old, if nore more )
    by upgrading , u will also get new security and better manageablitliy features as well.
    thanks
    sriram

  • Upload File size limitation in AIR ???

    Is there any upload file size limitation in air application ? Can any one post me the related articles on AIR application Multiple file upload ??
    Regards,
    Rahul.

    Hi Rahul, i dont understand completly your question, but i was have a similar situation some years ago.
    The limitation is not by AIR, all local servers(wampp, xampp, etc) are limited in the command UPLOAD_FILES.
    This have by default 3 or 5 mb by each file to can be uploaded, only you have to do is change the default value in php.ini file to this line
    "upload_max_filesize".
    I hope this will help you

  • Image Upload - File Size Problem

    Hi,
    I have created an asp image upload page using the toolbox - everything works perfectly unless the image size is over 200KB. If an image is uploaded that exceeds 200KB then the page just empties all of the fields with no error message. I have set the limit within the image upload transaction to 3000KB. Is there something I have to do on IIS to allow larger file size uploads?
    Many thanks in advance
    Scott

    hello friend.
    a simple solution to this..
    are u using win2k3 ?
    i mean whats ur IIS version..
    if its IIS 6 then
    1.> first go to IIS server for the MMC
    2.> then right click and select the box which says allow metabase to be edited while IIS is running..
    3.>go to just go fire ur dreamweaver and browse open this folder.
    c:\windows\system32\inetsrv\metabase.xml
    is also called systempath on system drive
    changed this value
    of AspMaxRequestEntityAllowed
    to
    ="1073741824"
    it should look like this.
    AspMaxRequestEntityAllowed="1073741824"
    if there are mutiple enteries in the XML file u can safely change all these to the same value.
    Enjoy
    Moh!
    http://www.mohitech.com
    Sorry if there are spelling /grammar mistakes.. i dont bother to correct them :)

  • I am unable to upload files via web browser

    Good morning
    I have just upgraded to Mavericks (10.9.5), and I am running into a weird issue. I am unable to upload any files via the web browser. If I go to a website, and select an Upload File option, I am taken to Finder, where I am able to select the file, and press attach. The issue comes when I press upload on the website. It always either times out, or gives me an error that I was disconnected from the server. This happens on Safari, Firefox, and Chrome. I'm not sure what to do... I've repaired disk permissions and tried a lot of different security settings, but I am stumped.
    Thank you

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen. Click the Clear Display icon in the toolbar. Then take one of the actions that you're having trouble with. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of which is irrelevant to solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • Upload File Size

    I am creating a form where I will be asking individual companies to upload 2 to 3 case studies.  I know as a paid member my respondants are allowed upload files up to 20MB in size.  Is this 20MB total or 20MB per file?

    Try UploadBean :
    http://www.javazoom.net/jzservlets/uploadbean/uploadbean.html
    It could be used with CFU and you can specify upload size limit.

  • File Size Question: Browser vs. MediaManager vs. Finder

    Not an earth-shattering issue, but am just curious as to why the Browser, MM, and the Finder each offer different opinions as to the size of a given media file (or group of files).
    I've just finished capturing a couple of hours of HDV footage from a friend's Sony cam (model HDR-HC7). Used Capture Now with the pref to create new media files at any TC break. (Will later do selective shot-by-shot logging and transcoding into ProRes422, so this B-cam material can be easily combined with AVCHD-originated footage which is being ProRes'd on ingest. For now just had to get it all on disk, since my friend needs his camera back!)
    Anyway, everything went smoothly, but to use one file as an example, I happened to notice that in FCP7's "Size" Browser column, it's 78.2 MB; whereas MediaManager sees it as 77.1 MB; yet the Finder shows it as 82 MB.
    All the other captured files show a similar variation. Everything's in the same ballpark, of course -- and these days what's a few MBs between friends? -- but the differences total a couple of GBs by the end of day; still not a big deal in the grand scheme, just more of a variation than I would have predicted.
    So -- does anyone happen to know why this is the case? Do the Browser, MM, and the Finder each have different ways of evaluating how much space a particular media file is actually occupying, or are they each measuring subtly different things?
    Like I said -- just curious.
    Thanks,
    John B.
    Toronto

    +Is there a particular reason why it makes sense for the Browser to use one way, and the Finder to use the other?+
    Most likely it is down to which particular call is used by the programer to ascertain file size and therefore the way that file size data is returned to the app. Don't forget that the FCP's basic code is pretty darn old now and predates current best practices for file size reporting.
    +And why, staying with the above example, does the Media Manager come up with its own unique measurement altogether, different from BOTH of the others (or is that just part of its charm)?+
    Weird huh? And here's the bit you won't like ... I don't see the same discrepancy. On my system Media Manager and the Browser seem to report file sizes consistently.
    +Also -- am I correct in noticing that under Snow Leopard, Disk Utility has switched from one measurement scheme to the other? (DU suddenly seems to be seeing my 500GB drives as having a single-volume partition of -- gasp -- 500GB! Who would've thought?)+
    Yup, its a brave new world.

  • NMH410 as a external hard drive & upload files through web browser

    Hi,
    I had just installed a NMH410 and has some questions as follow:
    Can NMH410 be used as an external HDD without internet?
    Is there anywhere I can upload files through the web browser?

    mosidiot wrote:
    I had just installed a NMH410 and has some questions as follows:
    1. Can NMH410 be used as an external HDD without internet?
    Yes - The NMH is a local network device, and you can store/retrieve files on it using the computers on your home network using either Windows Explorer, or connecting to it in Linux/MacOS as a Samba share.
    However: The NMH requires an Internet connection to dowload firmware updates, and - If my experiences today are anything to go on - You'll need to have up to date Flash support in your web browser to be able to configure and administrate the thing.
    (See the new thread that I'll be posting in this forum shortly.)
    mosidiot wrote:
    2. Is there anywhere I can upload files through the web browser?
    Yes - The NMH does support uploading via a web browser as long as the latter has a recent Flash plugin installed. For small numbers of files, this should work fine...But for larger numbers of files, I'd suggest using either Windows Explorer, or the Media Importer program that came on the enclosed CD-ROM. :-)
    You can find full details and instructions for doing both of the above in the NMH 4xx user guide, which may be downloaded Here. :-)
    Farewell... >:-)
    +++ DieselDragon +++
    Edit: Corrected broken link to user guide.

  • PE 10 YouTube Upload file sizes

    PE10 gives estimates for file sizes under the various Share options. I notice for YouTube presets that in selecting between PAL Widescreen, 1440 x 1080 and 1920 x 1080 to my considerable surprize the last one is the smallest estimated files size by a big margin (50%!). Is this actually right, so that to limit upload transfers the highest setting actually gives the smallest upload? I usually use the 1920 setting but recently I have been uploading video which was shot at 1440 and I have tried uploading this with both the other settings and it takes for ever, so perhaps it is the case that the 1920 setting actually is a much smaller files size - seems unlikely however.
    Andrew

    Andrew
    Thanks for the sample file for me to check out in my Premiere Elements 10 on Windows 7 64 bit.
    I am not seeing the trend that you are seeing with regard to the YouTube estimate for file size for the uploads from within Premiere Elements 10 Share/Online/YouTube
    For the sample that you sent
    1440 x 1080 HD anamorphic 16:9 @ 25 interlaced frame per second (H.264.m2ts)
    File Size 43 MB, Duration 36.00 seconds
    YouTube Preset and its File Size Estimate
    PAL - Flash Video For YouTube (Widescreen).....................13.46 MB
    PAL - High Definition Video For YouTube 1440 x 1080.........26.64 MB
    PAL - High Definition Video For YouTube 1920 x 1080.........35.71 MB
    Flash Video For YouTube (Widescreen)..............................13.46 MB
    High Definition Video For YouTube (1440 x 1080)................26.64 MB
    High Definition Video For YouTube (1920 x 1080)................35.71 MB
    Please let me know how close you came to the above file sizes when you tested that same sample file in your computer environment.
    Let us try this.
    Take the file that you sent as a sample here, and import that into a Premiere Elements 10 project (PAL AVCHD HD1080i25)
    Go to Share/Computer/AVCHD and Presets.
    Set the Preset first to
    M2T - H264 1440 x 1080i25
    What do you see as the estimated file size? I am seeing 181.32 MB.
    Set the Preset next to
    M2t - H264 1920 x 1080i25
    What do you see as the estimated file size? I am seeing 226.22 MB.
    The duration of the file (36.00 seconds) stayed the same throughout.
    Depending on your answers, we can decide whether an uninstall reinstall of QuickTime and/or Premiere Elements 10 would be in order.
    Thanks.
    ATR

  • How to restrict the upload file size in me21n/me22n/me23n?

    Hi Guru's,
    I have a requirement to restrict the user from attaching a local file more than 20MB in Purchase Order.
    In standard SAP system, the user can attach a file of any size in PO. How to restrict the size of the file?
    I have no clue how to achieve this? Any kind of help would be great...
    Thanks in Advance...
    Regards,
    Satyam

    Hi Guru's,
    The file size is now restricted in function GUI_UPLOAD. But this function module is used at many places. I want to restrict it only for Tcode: ME22n and ME23n.
    I thought of restricting it by sy-tcode field but sy-tcode value  is not passed to this function module in the run time.
    Could anyone help me on this how to restrict it for the above mentioned tcodes??
    Regards,
    Satyam

  • Problem in Upload files with Default Browser

    I love to use the default broswer to upload files to server due to its functionality. But today I came across something weird. I wanted to upload apk files to google play store, and when I click upload, the playbook file manager will open for me to select the file to upload, but the problem is the playbook file manager is limited to display some file formats like "apk, bar, mus, finale, tar, bz2 and bin".  I will like an update to fix this issue.
    Thanks.

    try by using System.err.println insted of System.out.println
    I'vs tried it with J2EE it works.

  • ML wiki - increase upload file size

    Hi I would like to increase the max file size I can attach to a wiki. Apparently you used to be able to use Admin server. Is it possible to change in Mountain Lion?
    thanks

    https://help.apple.com/advancedserveradmin/mac/10.8/#apd59153f0a-7ed3-4c64-9c74- 3a1fff831475

  • Client to Server upload: File size limit

    Hi,
    I am utilising java sockets to set up 2 way communication between a client and server program.
    I have successfully transferred files from the client to the server by writing/using the code shown below.
    However I now wish to place a limit on the size of any file that a user can transfer
    to the server. I think a file size limit of 1 megabyte would be ideal. Does anyone know a straightforward
    way to implement this restriction (without having to perform major modification to the code below)?
    Thanks for your help.
    *****Extract from Client.java******
    if (control.equals("2"))
         control="STOR";
         System.out.print("Enter relevant file name to be sent to server:");
         String nameOfFile = current.readLine(); //Read in the name of the file to be sent, store in a
    addLog("File name to be sent to server: " +nameOfFile);
         if(checkExists(nameOfFile)) //Call the checkExists method to make sure the user is sending a
         infoOuputStream.writeUTF(control);
         infoOuputStream.writeUTF(nameOfFile); //write the file name out to the socket
         OutputStream out = projSocket.getOutputStream(); //open an output stream to send the data
         sendFile(nameOfFile,out);
         addLog("File has been sent to server " +nameOfFile );
         else
              System.out.println("Error: The file is invalid or does not exist");
              addLog(" The user has attempted to send a file that does not exist" +nameOfFile);
    private static void sendFile ( String file, OutputStream output ) {
    try {
              FileInputStream input = new FileInputStream ( file );
    int value = input.read();
    while ( value != -1 ) {
    output.write ( value );
    value = input.read();
    output.flush();
    catch ( Exception ex ) {
    *****Extract from Server.java******
    if (incoming.equals("STOR"))
              String filename = iStream.readUTF(); //read in the string object (filename)
              InputStream in = projSock.getInputStream();
              handleFile ( in, filename ); //read in the file itself
         addLog("File successfully sent to server: " +filename);  //Record the send event in the log file
              System.out.println("Send Operation Successful: " + filename);
    private static void handleFile ( InputStream input, String file ) {
    try {
              FileOutputStream output = new FileOutputStream ( file );
    int value = input.read();
    while ( value != -1 ) {
    output.write ( value );
    value = input.read();
    output.flush();
    catch ( Exception ex ) {

    Thanks for the advice. Have it working perfectly nowGlad it helped. You have no idea how refreshing it is that you didn't respond with, "Can you send me the code?" Nice to see there are still folk posting here who can figure out how to make things work with just a pointer or two...
    Grant

Maybe you are looking for

  • 10.6.8 update: screen brightness issues when hooked to external monitor

    I just upgraded to MacOS 10.6.8 yesterday, and since then, the screen on my Macbook is acting strange.  I'm hooked up to an external monitor which I use almost all the time as the primary monitor.  Usually, when I'm using the external, I turn the bri

  • Combined pdf files with garbage fonts

    I need help with creating a combined pdf document.  I start with word 2013, and use the styles to create a linked table of contents.  Then Save As to a pdf.  I deselect the Options to allow the links to work in the pdf format.  Then I add other pdf's

  • How do I know if my imac has a web cam? I want to skype with my grandkids. Thank you

    How do I know if my iMac has a web cam on it so I can skype with my grandkids? Could I buy a logitech webcam for $24.98 that is on Amazon? Thank you

  • BPF - slow interface

    Hi, I am setting up BPF templates and I noticed that the web page which opens when I click on Business Process Flow from the BPC landing page is becoming slower and slower. The reason seems to be that the page always loads all the BPFs (with steps an

  • WSUS 4.0 and SCCM 2012 SP1 Sync Errors

    SCCM 2012 SP1 is installed on a Windows 2012 Std server with the WSUS 4.0 Role installed. All other links I have found list a 2008 R2 Server with WSUS 3.0 SP2 hence all the "fixes" revolve around hot fixes and patches/settings for WSUS 3.0 or 2008 R2