Upload file jsp code doesn't work? How can I debug

Hi Everyone,
I have the following jsp code that simply adds a new product to the backend database when 'Continue' button is pressed.
if( "Continue".equals(fp.getParameter("Submit")) ) {
     fp.setParameters(prodForm);
     prodForm.setCreateBy(currentUser.getUserID());
     prodForm.save();
     String filename = fp.getFilename("file");
          if( filename != null ) {
          // a file was uploaded
          // set the path to save it
          fp.setFilePath(PHYSICAL_PATH + "uploads\\");
          // we will change the filename to make sure it is unique
          // need to keep the file type
          String fileType = "";
          try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
          catch( Exception e ) { fileType = ""; }
          fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
          prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
          prodForm.save();
     db.close();
     response.sendRedirect("index.jsp");
     return;
}The code works fine but the upload doesn't work. This is the upload part of the above code:
String filename = fp.getFilename("file");
          if( filename != null ) {
          // a file was uploaded
          // set the path to save it
          fp.setFilePath(PHYSICAL_PATH + "uploads\\");
          // we will change the filename to make sure it is unique
          // need to keep the file type
          String fileType = "";
          try { fileType = filename.substring( filename.lastIndexOf(".") ).toLowerCase(); }
          catch( Exception e ) { fileType = ""; }
          fp.saveFile("file", "POS_" + prodForm.getProductID() + fileType);
          prodForm.setSketch("POS_" + prodForm.getProductID() + fileType);
          prodForm.save();
     db.close();
     response.sendRedirect("index.jsp");So if the file browser, <input type="file" name="file">, has a file, then it saves the file in the upload folder and saves the filename in the database. But it doesn't work, it doesn't save the file in the upload folder nor it saves the filename in the database. I am new to java and jsp so could you tell me what error checking or deguging I can do in jsp to spot the problem.
Thanks,
Zub

where u write the code to upload the file
to server end?

Similar Messages

  • My live corners widget doesn't work, how can i fix it ?

    my live corners widget doesn't work, how can i fix it ?

    jotapepea,
    You may have a look at the list below. The easy ones are at the top.
    The following is a general list of things you may try when the issue is not in a specific file (you may have tried/done some of them already); 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to 3 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall, run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • HT201209 I use a Gift card to buy a game and it doesn't work how can I get my money back please help

    I used a gift card to buy games and one of them doesn't  work how can I get my money back

    If the game doesn't work (and you've tried deleting it and re-downloading it via the Purchased tab in the App Store app and you've also tried contacting the app's developer) then try the 'report a problem' page to contact iTunes Support : http://reportaproblem.apple.com
    If the 'report a problem' link doesn't work then you can try contacting iTunes support via this page : http://www.apple.com/support/itunes/contact/- click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • My magsafe adapter doesn't work, how can i solve this problem?

    my magsafe adapter doesn't work, how can i solve this problem?

    You can get a 60W power adapter for about $20 on eBay http://www.ebay.com/sch/i.html?_trkparms=65%253A1%257C66%253A2%257C39%253A1&rt=n c&_nkw=macbook+power+adapter&_dmpt=Laptop_Adapters_Chargers&_sticky=1&_trksid=p 3 286.c0.m14&_sop=12&_sc=1

  • My iMessage and FaceTime doesn't work. how can i get it working?

    my iMessage and FaceTime doesn't work. how can i get it working?

    Without more information such as:
    - what happens when your try?
    - DId it work before and other things
    all I can suggest is:
    iOS: Troubleshooting FaceTime
    iOS: Troubleshooting Messages

  • My iPod touch home button doesn't work how can I fix it

    My iPod touches home button doesn't work how can I fix it and how much will it cost if I get apple to fix it ?

    See:
    fix for Home button
    Fix a broken, unresponsive or sticky iPhone Home Button
    Apple will only exchange the iPod for a refurbished one for:
    Apple - Support - iPod - Repair pricing
    Try a third-party place like the following.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Use the Assistive Touch Accessibility feature if you have iOS 5.

  • HT5502 AFTER UPGRADING TOMOUNTAIN LION SAFARI 6.0 DOESN"T WORK HOW CAN I REPLACE IT OR UPGRADE IT?

    AFTER UPGRADING TOMOUNTAIN LION SAFARI 6.0 DOESN"T WORK HOW CAN I REPLACE IT OR UPGRADE IT?

    An answer will require more specific information of the problems you are experiencing Mpittas2.
    In general, if you installed any third party anti-virus utilities, get rid of them. They can cause problems like this.
    There is no need to post your question multiple times. If you don't get an answer right away give it some time, a few hours at least, and please deselect your caps lock key. This will increase the likelihood of receiving competent assistance.
    Thanks!

  • My sleep buttom doesn't work how can i fix it?

    i have a ipod touch and the sleep buttom doesn't work how can i fix it? thank you

    Hi,
    some people round here had success using a 'Standard DVD-cleaner disc' like the ones for Home Theater Systems.
    Regards
    Stefan

  • The keyboard of my macbook air doesn't work,how can I do?

    my keyboard doesn't work ,how can I do?
    ps:My English is soso ,I cannot tell the problem claerly in English.

    Try using an external USB keyboard. If it doesn't work, then somethings
    probably wrong with the computer.
    Best of luck!

  • Help iPhone 4 "Power Button doesn't work", how can I get repair it and how much will cost, want to keep same phone everything works fine not power button. :(

    My iPhone 4 power button doesn't work, how can I get repair it and how much will cost, want to keep same phone everything works fine not power button not working unable used my phone. My warranty is Expired how much will cost to put it on my phone plan? Thanks!

    Hi Julio,
    Here's a link for your question:
    http://support.apple.com/kb/index?page=servicefaq&geo=United_States&product=ipho ne
    Cheers,
    GB

  • Hi guys, my iPhone 4S (ios 7.0.2) can't connect wi-fi. I've already reseted Network Settings, but Wi-fi still doesn't work. how can I fix it? thank you!

    hi guys, my iPhone 4S (ios 7.0.2) can't connect wi-fi. I've already reseted Network Settings, but Wi-fi still doesn't work. how can I fix it? thank you!

    Thank you!
    doesn't like one at Starbucks or McDonald's...
    I can not activate or deactivate the Wi-fi button ... I don't know how I can explain... the wi-fi is always OFF.
    I've reset the network settings and restored by itunes... but I'm still without wi-fi ...

  • My alerts work when I'm on the phone such as text message Facebook n Instagram but when I'm off the phone it doesn't work how can I fix this :(

    My alerts work when I'm on the phone such as text message Facebook n Instagram but when I'm off the phone it doesn't work how can I fix this :(

    Hello, Trillmonroe. 
    Thank you for visiting Apple Support Communities. 
    Try forcing all open applications to close and power cycle the device as outlined in the first two sections of the article below.  If the issue persists, try the troubleshooting steps in the second article. 
    Restart the app
    Close the app and open it again.
    Restart your device
    Turn the device off and on.
    iOS: An app you installed unexpectedly quits, stops responding, or won’t open
    http://support.apple.com/kb/ts1702
    iOS: Understanding notifications
    http://support.apple.com/kb/ht3576
    Cheers,
    Jason H. 

  • When I Backup iphone 5s and i want to restore my photo but It doesn't work.How can I do friends thank for your answer

    when I Backup Iphone 5s and i want to restore my photo but It doesn't work.How can I do friends thank for your answer

    What do you mean it doesn't work?
    Are you getting an error message?
    ~Lyssa

  • I'm trying to install the iOS 7 but it doesn't work how can I install it?

    I can't install my iOS 7 it doesn't work how can I install
    It?

    I suggest you scroll down and use the "Update your device using iTunes" method here:
    http://support.apple.com/kb/HT4623

  • My speaker doesn't work. how can i do to make it work?

    Hello, My name is Anh and i think i need your help.
    I have bought my Notebook  Probook 4530s for a haft month, at first my speaker worked well, but after that a few days, it doesn't work well as the first. Now i am in Osaka, Japan for my work, but i bought it in Vietnam. Please tell me how i can make the speaker work well again. I didn't  change anything since i bought it , only update windows. Please help me...
    Sincerely

    Hi there sugardeer,
    I would recommend taking a look at the troubleshooting steps found in the article below.
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/TS1630
    -Griff W.

Maybe you are looking for

  • MY IPOD TOUCH IS IN RECOVERY MODE

    MY IPOD IS IN RECOVERY MODE.IT HAS A CONNECTING TO ITUNES LOGO I TRIED REBOOTING IT IT DOES NOT WORK I TRIED ATLEAST SEARCHING FOR DEVICE WITH ITUNES IT DOESN'T APPEAR. I TRIED PRETTY MUCH WHAT ADVICE I HAVE BEEN GIVING ANY OTHER IDEAS PLEASE HELP!!

  • Can't install 11.0.1 update in Windows 7 64 bit

    When I run update, I got the following: Adobe setup has stopped working Windows can check online for a solution to the problem Check online for a solution and close the program Close the program Problem signature:   Problem Event Name:    APPCRASH  

  • Pan Zoom Feature For Diagram

    I have a data visual that I basically need to integrate a panning and zooming widget too.... Basically I need a small window of the data visualization at the bottom corner, and I will need the user to be able to zoom in and out and scroll around the

  • Deletion of DDIC Table with Maintaince View

    Hello, I try to delete a  table with existing maintance dialog. So first I deleted the generated objects in SE54. The corresponding funtion group is now no longer existing. When I now try to delete the table in SE11 I got the message that it is still

  • Why am i getting an error message 13010

    Why can i not open my Itunes.  i keep gettin an error message #13010?