MultipartRequest, how can I control this?

Hi Everybody, I'm building a web page in Jsp, and in this the user can send to the server a file (a picture). The file arrive to the server thanks to 'MultipartRequest'. This is the code:
File newDir = new File(Dir);
newDir.mkdir();
MultipartRequest multi = null;
try
multi = new MultipartRequest(request, Dir, 90000);
catch (IOException e){ }
My question is, how can I control, that the file is not a virus or its lenght is too much?
Thanks for all

Hi, I believe you are using the com.oreilly.servlet package.
If so you probably also have the com.oreilly.servlet.multipart package too.
So you could try to use the MultipartParser class which I believe it's better to handle MultipartRequests.
The constructor is MultipartParser(request,size), and then you have a readNextPart() method. Then you can check if this part is a FilePart.
Once you have a FilePart, you can get its fileName (by getFileName()) and would be easy to control if the file's type is what you wanted (e.g. gif,jpeg,...).
Regarding the file size I haven't found a direct method but I believe you should analyse this package and with some workaround it should be done.
Hope this helps, regards.

Similar Messages

  • Split PR/PO values to allow pass approval limit, how can we control this?

    Is there a way to limit the number of approvals that can be done on PR / PO per hour / day / week (for the same account, position, category, item).
    The purpose of this not to enable users to split the PR/PO values in multiple PR/PO to allow approval limit pass, that is, PR = $3000 will not be approved since it is more that the approval limit of finance manager whereas PR 1 = $1000, PR 2 = $ 1000, PR 3 = $ 1000 will pass.
    How can we avoid this?

    Thank you Martin for your reply.
    In option 2 does this mean if I am a member of the help desk who has the privilege to edit the user, I will be able to go to users/manage and another users/manage2 for example. In users/manage, I can view all the fields on the user with no edit button. In users/manage2, I can view only the fields I am authorized to edit, and there is an edit button on this page?
    I have never done this so I am trying to imagine what the interface would look like and what the data flow would be.
    In option 3, I have never thought of this solution. But now I understand that this could be an option.
    Thanks
    Khanh
    Edited by: Khanh on Nov 10, 2009 10:28 AM

  • DAQ Assistant: How Can I Control this at the lowest Level?

    DAQ Assistant:
    I have the PCI slot version of this which I use to generate specific signatures. However I would like to get down to the very low level of this block to see what makes it tick if only to add some other features such as have it dynamically change high and low times after "N" number of pluses/bursts.
    At the current state I can't seem to get any further than the GUI that I work with right now. I can give you a VI upon request however this VI is included with labview from what I understand I have version 8.2. If anyone wants a copy of the vi which contains the DAQ Assistant block I will be more than happy to include.
    DAQ Assistant Location: Right click on the block diagram of a VI --> Measurement I/O --> NI-DAQmx --> DAQ Assist (This is an icon in itself)
    I see the read,write nodes however I have played and tried to see what they do but I have had no such luck. If anyone can point me in the right direction I would be grateful.
    Thank You.
    Solved!
    Go to Solution.

    You've got a couple of misconceptions about the DAQ Assistant. First, there is no such thing as a pci version. There are some slight differences between versions of the DAQmx driver. Second, the DAQ Assistant is a code generator. When you start it up, it will create custom code for the type of task you want (digital i/o, analaog i/o, etc.) so the VI you eventually have on the block diagram is not included in any version of LabVIEW.
    Once you have configured the assistant, you can right click on it and select 'Open Front Panel' this will convert the assistant task to a normal subVI that you can opne and view the block diagram. You can also right click and select 'Create DAQmx Code'. This will place the low level DAQmx functions on your block diagram. You could also skip the whole assistant and just start with the low level DAQmx functions in the first place. There is help associated with each and you have all of the shipping examples to look at. There is also the Getting Started with NI-DAQmx page.

  • When I am listening to music on my iPod Touch 5th gen and it is locked I try to double click the home button to bring up the music controls, but it does not work. How can I fix this?

    So, I locked my iPod while listening to music, then pressed to home button to turn it back on, then I pressed it again twice to bring up the music controls so I could pause the song. The music controls came up, but they didn't control the song I was listening to, also the album artwork wasn't showing. How can I fix this?

    Hello,
    I am currently an owner of an Ipod Touch 4th generation. I see you are having problems with your Ipod Touch, so I will try to find a solution to your problem.
    Hold down the Sleep/Wake and Home buttons for at least 10sec. or until Apple logo appears (Nothing will be lost, this is just a "Hard Reset")
    Hope that helps!
    If none of the above solutions work, can you please respond back ASAP as I will try to find another solution to your problem (This might even help others with the same problem!)
    Cheers!
    Pizza98704

  • Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    Since I upgraded to IOS5, my Smart Playlists are in a random order. Since I use it for listening to Talking Books this makes it useless. How can I control the order of a Smart Playlist?

    It may be best to recreate the folder and the smart playlists from scratch.
    tt2

  • Help! My Mouse pad is not working properly. The arrow cannot be controlled, it just keeps jumping all over the page. How can I stop this?

    Help! My Mouse pad is not working properly. The arrow cannot be controlled, it just keeps jumping all over the page. How can I stop this?

    There are several possible causes for this issue. Please take each of the following steps that you haven't already tried until it's resolved. Some may not apply in your case.
    1. Follow the instructions in this support article, and also this one, if applicable. A damaged or defective AC adapter could be the cause, even if it's the right kind.
    2. Press down all four corners of the trackpad at once and release. If there's any effect, it's likely to be temporary, and in that case the unit must be serviced or replaced.
    3. Open the Bluetooth preference pane in System Preferences and delete all pointing devices other than the trackpad, if applicable. Disconnect any USB pointing devices. By a "pointing device," I mean a peripheral that moves the cursor, such as a trackpad, mouse, trackball, or graphics tablet. A plain keyboard is not a pointing device.
    4. Start up in safe mode and test, preferably without launching any third-party applications. If you don't have the problem in safe mode, but it comes back when you restart as usual, stop here and post your results. Do the same if you can't start in safe mode. If there was no difference in safe mode, go on to the next step.
    5. Reset the System Management Controller.
    6. If you're using a Bluetooth trackpad, investigate potential sources of interference, including USB 3 devices.
    7. A swollen battery in a portable computer can impinge on the trackpad from below and cause erratic behavior. If you have trouble clicking the trackpad, this is likely the reason. The battery must be replaced without delay.
    8. There's a report that a (possibly defective) Thunderbolt Ethernet adapter can cause the built-in trackpad of a MacBook to  behave erratically. If you're using such an adapter, disconnect it and test.
    9. There's also a report of erratic cursor movements caused by an external display that was connected but not turned on.
    10. If none of the above applies, or if you have another reason to think that your computer is being remotely controlled, remove it from the network by turning off Wi-Fi (or your Wi-Fi access point), disconnecting from a Bluetooth network link, and unplugging the Ethernet cable or USB modem, whichever is applicable. If the cursor movements stop at once, you should suspect an intrusion.
    11. Make a "Genius" appointment at an Apple Store to have the machine and/or external trackpad tested.

  • Parental Controls are not working correctly.  Websites I've listed under Allow Access are still blocked.  How can I fix this?

    Parental Controls are not working correctly.  There are websites I've listed under Allow Access, however they are still blocked. - such as:  Yahoo mail and USAA banking.  How can I fix this?

    Hendry
    Just thought I'd let you know.  Our suspicions were correct, it was the OS. After I installed Snow Leopard (10.6.8) all the problems were corrected.  I also updated the RAM from 1 gb to 6 gb. The mac is working all around better. Sorry it took so long to get back to everyone. My superdrive had pooped out. Rather than replace it I got an external drive from OWC connected with firewire 800.  So far everything is running very well, as far as I can tell this external drive is better than the original superdrive. My superdrive has always acted funny, infact I returned the first mac I got after a week because its superdrive was also malfunctioning. Anyway, all that to say everything seems to be fully functioning again.
    Roy
    Re: Function keys are not working correctly 

  • Why does a new desktop creation unexpectedly initiate with a background differing from the originating desktop? How can I control or eliminate this behavior?

    Why does a new desktop creation unexpectedly initiate with a background differing from the originating desktop? How can I control or eliminate this behavior?

    CT, I suspect that I either mistated the question or don't understand how to set the default back ground.  In any case, with the background that I have set in system settings, and this is the background to which my sessions consistantly boot, new desktops come up for the second or up to the third background with this initially set background. Then in the third or fourth desktop creation (I seldom go beyond four), the background for the new desktop, is one that I was using one or two months ago...

  • On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this?

    On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this ?

    Thanks for posting this!
    I would only mention that your definition is incomplete for this -
    Contextual selector A type of Style Sheet Selector that
    and that it's most often referred to now as a Descendent selector, not a contextual selector.  It's basically the same as the Compound selector that you have already defined....

  • I would like make 3D text and panel that controls the bevel is missing. How can I fix this?

    I was making 3D text, and when I went to create a new project, I had written out my text and made it 3D but the panel that controls the bevel wasn't available anymore. How can I make this panel visible?

    Open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"
    Click the "Restore Default Set" button.
    * http://kb.mozillazine.org/Toolbar_customization

  • Apple TV uploads can take up to 30 minutes. I need control over this, because it interrupts my presentations. How can I control the time it chooses to do uploads?

    Apple TV uploads can take up to 30 minutes. I need control over this, because it interrupts my presentations. How can I control the time it chooses to do uploads?

    this is exactly the kind of response i expected, almost begged support to please not do this to me and yet there it is another meaningless, non helpful, standard template response to restart my apple tv.
    this does NOT work which is why i am contacting you. i have tried all suggestions about unplugging and restarting and nothing works.
    i live in an apartment and logon to the provided wifi wireless. so i do not have access to a router. however, management says they have talked with their provider and have been assured that the required ports are available.
    remember all the jokes about how bad windows was because the solution was always to re boot. funny huh? how is apple any different.
    i have been to the local apple care store and they are clueless, too.
    should we just end it here and you admit that i will not be getting any support from apple on this one? i got the ipad because my kids were such big fans. it is difficult for me to share their enthusiasm.
    at this point i am just curious about how you say you cannot support your own product so i can complete my file on this contact.
    thanks...sorry it was you who got this problem..

  • Finally I realised that my new iPad2 is a DEMO UNIT. Thats why I can't control the appl icons. How can I turn this unit like a retail one?

    Finally I realised that my new iPad2 is a DEMO UNIT. That's why I can't control the appl icons. How can I turn this unit like a retail one?

    Tasz66 wrote:
    Yes I can't. When I try to press and hold an icon, is doesn't wiggle. Also the label at the back of the box says "...white - Demo"
    Well I guess that settles that then!
    We just wanted to make sure that you did realize that you cannot delete the preinstalled apps and you can't download them again either, so if that was the basis on which you believed that you had a demo model, we were just double checking.

  • My child accidentally rented a movie on Apple TV.  Is there a way to refund the rental if we don't watch it?  How can I prevent this from happening?  Is there a way to password protect future purchases?

    My child accidentally rented a movie on Apple TV.  Is there a way to refund the rental if we don't watch it? 
    How can I prevent this from happening?  Is there a way to password protect future purchases?

    Did you try Parental Controls?
    Apple TV: Understanding Restrictions (parental controls) - Apple Support
    See if that does the trick: I think there's a way for you to request a password for purchases, but still be logged in.

  • TS1702 My cars 2 app mate app is not working after upgrading from ipad to ipad 2...... synced.... uninstalled and re installed several times as well as wiped ne ipad out and re did the whole proccess several times. how can I get this app working?

    I have installed the cars 2 app mate on a ipad 2 from an ipad 1 synced with itunes account.. all is working except this app. After many times of un installing and re installing aswell as talking to apple tech suport this app is still not working.... its there it just has no function...... how can i get this installed and working, my grandson is autistic and uses this app many hours a day........ it is important for me to get this up and running again for him.......

    (1) So, I found a youtube video showing how to open up my iMac and replace a Disk drive. I opened it. I removed the disk drive. I opened the metal cover of the lid of the disk drive. It was clean and immaculate; so, it destroyed and debunked the dirty drive theory. But, just to make sure I sucked around the optical sensor with a vacuum and gently brushed it with a Q-tip.
    (2) I then watched a you tube video showing how the drive operated (it was a drive supplied with power outside an iMac with a transparent cover unlike the opaque metal cover that we have on our drives). My scientific curiosity started to wonder if somehow the mechanical part (of the electro-mechanical assembly) was locked or jammed. So, I started messing with the arms with the utmost care after watching the video to see if i could move them manually. Yes on some. The main arm that is linked with the drive motor was immovable. The rest I played with a little bit, took great notice in the start of the video to see how the arms looked before inserting a disk. I then put it all back together.
    It works now. My guess is that taking it out and then placing it back in along with the resetting options that others have done was the trick. I believe it is a possibility that the hard drive became locked mechanically in some strange manner after ejecting a DVD in conjunction with the uploading of the new OS. I believe the actual removal, reinstallation, and resetting of the drive put everything back into sync. My computer sits in a climate controlled dust free environment. I knew for a fact that this hard drive was OKAY.

  • Regarding Mail:  When I return to my computer after it has gone to sleep, my accounts go offline, and are always asking me for the password.  THis is very annoying.  How can I prevent this?

    Regarding Mail:  When I return to my computer after it has gone to sleep, my accounts go offline, and are always asking me for the password.  THis is very annoying.  How can I prevent this?

    Back up all data.
    Launch the Keychain Access 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 Keychain Access in the icon grid.
    Select the login keychain from the list on the left side of the Keychain Access window. If your default keychain has a different name, select that.
    If the lock icon in the top left corner of the window shows that the keychain is locked, click to unlock it. You'll be prompted for the keychain password, which is the same as your login password, unless you've changed it.
    Right-click or control-click the login entry in the list. From the menu that pops up, select Change Settings for Keychain "login". In the sheet that opens, uncheck both boxes, if not already unchecked.
    From the menu bar, select
    Keychain Access ▹ Preferences ▹ First Aid
    If the box marked Keep login keychain unlocked is not checked, check it.
    Select
    Keychain Access ▹ Keychain First Aid
    from the menu bar and repair the keychain. Quit Keychain Access.

Maybe you are looking for