Restricting upload file size (without uploading it first!!)

The following code works in restricting the filesize, however it takes proportionately more time to tell you for bigger files. So does that mean its uploading it temporarily, reading it, finding out its too big, then deleting it? That would be completely backwards. Is there any way to check the filesize quickly? Because if someone tries to upload a 10mb file it will take an hour to tell them its too big!!
<cfif cgi.content_length GTE fileSizeLimit>
<cfoutput>
Your preset file is too big!
The maximum size allowed is #fileSizeLimit#
</cfoutput>
<cfabort>
<cfelse>
         <!--- Begin processing first file submission --->
    <cfif IsDefined('form.requiredfile_one') AND Trim(form.requiredfile_one) neq "">
        <cffile
            action="upload"
            destination="#dstfile#"
            filefield="requiredfile_one"
            nameconflict="makeunique">
            <cfset cookie.requiredfile_one = "#cffile.serverfile#">
            <cfset cookie.requiredfile_one_ext = "#cffile.serverfileext#">
        <cfquery name="rs_insert_1" datasource="062409js06ag">
            Insert Into presets
                (pfilename, pfilenameext, artistid, artistname, presetname, presetgenre, bpm, soundslike, daws, vsts, license, instructions)
                Values
                (<cfqueryparam value="#cookie.requiredfile_one#" cfsqltype="cf_sql_varchar">
                , <cfqueryparam value="#cookie.requiredfile_one_ext#" cfsqltype="cf_sql_varchar">,         #findname.ID#, '#findname.uname#', '#requiredname#', '#requiredgenre#', '#bpm#', '#soundslike#', '#requireddaw#', '#requiredvst#', '#requiredlicense#', '#requiredinstructions#')    
        </cfquery>      
        <cfquery name="qNewContact" datasource="062409js06ag">
        SELECT @@IDENTITY AS NEW_ID
        </cfquery>
        <cfset newContactID = qNewContact.NEW_ID />
    </cfif>
</cfif>

You might try using Flex on the client.  I have not tried this technique, but *perhaps* the Flex API allows more access to the file system than JavaScript.  Note that the FileReference class used in Flex file samples has a "size" property that *might* give you the size of the file on the client.
Note that this approach depends on the client using Flash Player and executing client-side code.
References:
Working with file upload and download
http://livedocs.adobe.com/flex/3/html/help.html?content=17_Networking_and_communications_7 .html
FileReference class
http://livedocs.adobe.com/flex/3/langref/flash/net/FileReference.html

Similar Messages

  • How to decrease PDF file size without losing quality of images and vector lines?

    I have several ai files that I saved as PDFs. Now I'm having problem with the size of this combine files. Can some one assist me with the proper way on decreasing file size without losing quality.
    Thank you.

    I am having the same problem with a different file that's in a different format mentioned above. I'm trying to convert a ".srf" file and turn it into a ".pdf." I was successful doing this but my image, once in a .pdf was also pixilated.
    I thought if I convert my ".srf" file to a ".jpeg" first, then bring this newly created ".jpeg" into a ".pdf," I would have more luck. But unfortunately the free download I got on my computer that's supposed to convert any file to any file, CANNOT convert ".srf" files to ANYTHING!
    Does anyone have any ideas? Or any specific programs I should get?
    Thanks!

  • Any way to have file size included in the first search in finder?

    Is it possible to somehow show file sizes when doing a search in finder?
    On Panther, it was very helpful to have the file sizes listed. This immediately revealed whether the photoshop files I was looking for were full size or reduced.
    But when I run a search in Snow Leopard it only shows name, kind and last opened. Otherwise I have to also add a second search to add in file size.
    Any way to have file size included in the first search?
    Thanks!

    Well, I wish I could take credit for knowing it was there before two days ago... but I dropped my laptop a couple months ago and it finally died for good on Friday, and I noticed this on the new laptop when setting up my Finder preferences.

  • When I import my Sony video, which is in m2ts format, the file size is a few times larger.  This affects the volume of clips for creating the blu-ray or DVD discs.  How can I squeeze the file size without sacrificing the quality of output?

    When I import my Sony video, which is in m2ts format, the file size is a few times larger.  This affects the volume of clips for creating the blu-ray or DVD discs.  How can I squeeze the file size without sacrificing the quality of output?  Is there any other ways of achieving this?

    wongrayd wrote:
    Thanks.  I do not have the experience on burning discs from iMovie for the movie after editing (ie for video discs players).  It seems that i cannot find the relevant command in the tool bar for this purpsoe.  Would you please show me the way?
    The command is gone because iDVD has been discontinued by Apple. After Apple discontinued iDVD they removed the iDVD burning link from iMovie. I still use iDVD sometimes, only because I have an old copy.
    wongrayd wrote:
    You have mentioned about Handbrake as a converter.  What is the RF no. (under Constant Quality) meant?  It seems that the smaller the no. is, the better quality will be.  What is the optimal no.? or should we use the Average Bitrate? Again, what is the best rate?  Furthermore, which format is more suitable or the best: H264 or mpeg 2/4?
    I don't know what RF means. When I have used HandBrake, I've used presets that apply to what I want to do, so I don't know the meaning of each individual setting. However, it appears that many of them are listed in the HandBrake User's Guide that is linked from the Help menu in the program:
    https://trac.handbrake.fr/wiki/HandBrakeGuide
    wongrayd wrote:
    For iMac, except iMovie, what other software is the best for the amateur?  I have read Photoshop.  Can this support m2ts files and user friendly?
    Photoshop is not amateur-level software, and although it can edit a video, it cannot burn a DVD. Unfortunately, because I still use iMovie, I haven't tried anything else. You might want to read the reviews of various DVD-burning applications in the Mac App Store.
    And maybe another forum member will jump in and help us here!

  • Ulimit and launchctl both fail to restrict maximum file size

    I've submitted a bug report, but I figured I'd open this up to the community.  I can't seem to find any way to set restrictions on the maximum file size that can be created on OS X.   I've tested both Snow Leopard and Lion.
    *** Ulimit method:
    $ ulimit -f 100000
    $ ulimit -f
    100000
    $ dd if=/dev/zero of=/tmp/zero
    Filesize limit exceeded: 25
    $ ls -al /tmp/zero
    -rw-r--r--  1 admin  wheel  102400000 Jul  5 08:23 /tmp/zero
    $ ulimit -f
    unlimited
    *** launchctl method:
    $ launchctl limit filesize 100000
    $ launchctl limit filesize
    filesize    100000         100000        
    $ dd if=/dev/zero of=/tmp/zero
    dd: /tmp/zero: No space left on device
    54883985+0 records in
    54883984+0 records out
    28100599808 bytes transferred in 683.205935 secs (41130497 bytes/sec)
    $ ls -al /tmp/zero
    -rw-r--r--  1 admin  wheel  28100599808 Jul  5 08:36 /tmp/zero
    $ launchctl limit filesize
    filesize    unlimited      100000        
    In the first case, a limit does get set.  But when the first launched application returns control back to the terminal, the limit gets reset back to "unlimited".    In the second case, launchctl does appear to list a soft and hard limit for "filesize", however it does not stop dd from filling up the disk.  Running launchctl again shows an "unlimited" soft limit, but the hard limit remains.
    I've even tried setting a persistent, global limit via /etc/launchd.conf.   launchctl reports this limit, however there is nothing stopping huge files from being created.
    I do think that this is a bug on OS X, but perhaps there's something I'm overlooking?  If it is a bug, is there some workaround that I can use?
    Thanks
    -WD

    There are no file size limits to the software beyond what would be imposed by the operating system itself and the file format of the drive.
    So...assuming you have enough drive space, something else is going on.

  • Reducing file size without loosing clarity

    I have two designs for labels that have to be approved by the government for type size regulations.  The current size of the illustrator files are 133.3 MB and 24.7 MB I need to provide these at no larger than 450 kb AND the type must be readable and measurable for approval.
    I have tried everything I can think of to provide the artwork small enough yet still retaining enough resolution to not make the type fuzzy and not able to be measured for size.  I've tried making the files from within illustrator, I've tried taking everything into Photoshop to make the JPEGS with no luck.  They want either a gif, jpeg or tiff no larger than 450 kb that is viewable at the print size of the label with no loss of resolution... Does anyone have any suggestions on how to create these?
    Thanks in advance,
    Nina

    Photos, type gradients, complex paths, etc... and yes I know if they would just accept PDF files it would be no problem, but this is the Federal Government.  Do they ever do anything the easiest way.
    I think I figured out a way to get these down in size without lossing too much... I took the background with all the complex paths and I made a separate JPEG put that back into an illustrator file, placed the type over it and made an RGB JPEG out of illustrator...used the type hinting and a low setting.  Got it down to 425 kb and well the type looks pretty darn good.  I hope this works because I've done this well over a dozen times and they've all been rejected.  This is the info the agency sent regarding it being rejected:
    "Per Industry Circular 2011-4, your application and label(s) have not been reviewed for type size, characters per inch or contrasting background. The responsible industry member must continue to ensure that the mandatory information on the actual labels is displayed in the correct type size, number of characters per inch, and on a contrasting background in accordance with the TTB labeling regulations, 27 CFR parts 4, 5, 7, and 16, as applicable."
    "One or more of your label images appear too small for the proper evaluation of your label(s). When the dimensions you specify are applied to the label, the system renders your label as a blurred image. Please remove the current image(s) and replace it with new, larger image(s). We advise that, when you develop your label images, the compression ratio should be set at MEDIUM or LOW so that the file is still within the file size limit of 450KB"
    Thanks for your comment!

  • Reducing AI file size, without converting to another file type CS6

    I designed artwork for a large banner (84" x 32") so my AI artboard is that large. As you can imagine, with all the text and graphics I used, this file size is 22.8 MB. I need to email this art to the printer, but the file size is too large to email. How do i go about reducing the file size in AI so it still maintains large format print resolution? Will saving to a PDF lose the print quality? I'm at a dead end... help!

    For a 84" x 32" banner (vinyl, fabric/paper) a small amount of compression should be fine.
    I would start out with the high quality setting which gives you compression but at maximum quality 300 dpi.  this should make your 22.8mb file much smaller, (my guess without seeing your art is you have an image in there and will get under 10mb)
    If you need a smaller file yet,  go down to 200 dpi (change top 4 values to 200) and max to high quality to make the .pdf even smaller, and for a medium sized banner as you have that would look very good and you would have to look hard to see the difference, at a distance would be unnoticeable.

  • Cp and mv just increase file size without quitting on btrfs

    hi all,
    sry for the uncertain topic description but i didn't know how to describe this bug properly.
    every time i copy or move (using coreutils) a file from one btrfs partition to another, cp and mv just create the file in the destination folder but won't quit after the file has been transferred.
    this means the file grows and grows until the size of the volume has been reachead (I/O error no more free space available).
    is it a known bug? caused by btrfs or coreutils? rsync works fine!
    best regards

    thanks allan, downgrading coreutils helped.
    strange, i guess i didn't notice it until now since i rsynced without problem to external drive this whole time, which ext4. but cp/mv messes up (as per this topic title). so it's not just between btrfs..
    in fact, i have two btrfs harddrives on my laptop with multiple subvolumes on each one. most are compressed. i can cp/mv between compressed and non-compressed, regardless of which btrfs device, without having this error at all. the only time i have a problem is cp/mv to NON-btrfs filesystem (so far tested with ext4 and reiserfs, both mess up with cp/mv but not rsync). but yes, downgrading coreutils helped. just thought i'd share my experience with it. hopefully 2.6.38 will fix permanetly but i'll have to wait on that.
    edit: running kernel 2.6.36
    Last edited by milomouse (2011-03-02 21:08:05)

  • I've exported my pages graphics document as a PDF file and can't seem to reduce the file size without compromising the quality of the photo's used even after choosing "best" quality.  I'm trying to send the file via e-mail but it's too big.  ??????

    I am trying to e-mail a graphics pages document I made as a PDF file.  After trying to resize the file, the photo's quality is compromised (really blurry) even after choosing "Best" quality.  What am I doing wrong.  As a regular full sized file (PDF) it's fine, but when it gets reduced, it's bad and it needs to get printed from the e-mail copy I'm trying to send.  HELP! Please.

    If there are a lot and/or large images the file will inevitably be large, no matter what.
    You can reduce them down as far as possible by cropping and scaling them to the final size before creating the pdf. You can do this by opening the images in Preview .app and using Menu > Tools to reduce the resolution and to crop.
    If you have used transparency effects eg shadow, reflection, transparency, 3D charts, OSX will by default render these at 72dpi in the pdf.
    Peter

  • Increase DBFS file size without changing the mount point

    Dear All,
    We have 1 TB disk space (available is 890GB*) allocated as Content server for Storing File.
    We use DBFS Mode for Storing Documents.
    We have one mountpoint which points to the above content server.
    Now, the scenario is only 10% of Space is remaining in content Server.
    No Doubt we have new content server of 1 tb but adding it in DBFS will create new mountpoint which is not advisable for ongoing projects.
    Appreciate your suggestions.
    Regards,
    Chinmay Joshi

    Hi,
    So to be sure:
    1. Your Portal Server with the KM repository DBFS
    ...points to...
    2. Your Content Server is configured with a FS Repository Storage
    3. Repository  resides on 1TB data storage
    Can you not just add the 1TB additional storage to the existing storage?
    Possibly a restart is needed of the content server to make the enlarged storage available.
    Other option is to create a new storage location with, lets say, 2TB and export/import the data to it.
    Cheers,
    Benjamin

  • How to configure file upload restriction by file extension or size?

    Hi,
    I have recently configured a 7.0 portal with the BI-JAVA component. A feature for the BW reports and IP iviews is that a user can add comment and even upload a file to a default BI repisotory. It is easy to restrict access to users by means of ACL, but i also want to avoid users from uploading anything apart from *.PDF. It would also be nice to restrict in file size (otherwise it is easy to just rename a file you are uploading). Is there someting available to implement this in the portal?
    I have read some threads that state this is not possible by default and only by creating a custom repository service or just hacking the upload command. These threads seem rather old and i dont know if the presented solution is still valid. Does anybody know if SAP is to delever a solution for this? (perhaps in an enhancement pack?)

    Hi,
        Is there someting available to implement this in the portal?
        No. You have to develop this functionality.
        Have you read this blog: Restricting The Size Of The File To Be Upload in CM Repository ?
        https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3219
    Patricio.

  • 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.

  • Output file size restrictions - HD Video for YouTube

    For over a year YouTube has removed restrictions on file sizes for individuals that want to do so.  The preset output in Premier Elements 11 for "Online - HD Video for YouTube 1920X1080" will not allow a video longer than 15 minutes.  I need to remove this restriction and be able to produce files to upload to YouTube without file size restrictions.  How can I do this?

    TheBanjoNut
    You cannot. And, Premiere Elements 12 has the same YouTube limitations as 11.
    You need to export your Timeline to a file saved to the computer hard drive, and then upload that file to YouTube at the YouTube web site.
    At YouTube, you would need to explore the opportunities that it offers in the way of "extended times". It may require special accounts.
    Without further details of your Premiere Elements project preset and the properties of your source media, I would generalize and suggest that you look at the follow choices for creating this file for upload to YouTube at the YouTube web site...
    Publish+Share
    Computer
    AVCHD
    with Presets =
    MP4 - H.264 1920 x 1080p30
    or
    YouTube Widescreen HD (changing the settings under the Advanced Button/Video Tab of the preset)
    Please review. If you have any further questions on this, please do not hesitate to ask.
    Thanks.
    ATR

  • How do I change a photo's file size?

    I need to upload a photo to a website, but it can't be larger than 2mb.  How can I save it as a smaller file size?

    Changing the quality setting will apply more jpeg compression to the file and reduce its file size without reducing the image size.  If you want to reduce the image size also then change the pixel dimensions as Larry methoned.  A combination of the two can get you the best possible image at the 2 MB or less file size.  May take a little trial and error.
    OT

  • How do I decrease a movie's file size in imovie

    I need to upload a video to a website but the movie is 119mb and the website will only allow 40mb maximum.  How do I decrease the file size so I can upload it?

    Changing the quality setting will apply more jpeg compression to the file and reduce its file size without reducing the image size.  If you want to reduce the image size also then change the pixel dimensions as Larry methoned.  A combination of the two can get you the best possible image at the 2 MB or less file size.  May take a little trial and error.
    OT

Maybe you are looking for