Getting access denied error while importing file using input type="file"

Hi All,
I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like:
<input type="file" id="uploadFile" name="uploadFile" size="50">
I have the import button on which I have used onClick event to call javascript function submitValues() used to validate all the fields from the page which goes like:
<input type="button" name="select" value="Import" class="CSSButton" onClick="javascript:submitValues();">
The JS function then in turn submits the form and calls the action.The problem is sometimes even when the correct path is specified for the file to be imported results in access denied error.This error comes sometimes and other times it works fine.But when this error comes,I need to relogin into the application and then it works fine.I am using IE7 for this.
Any idea why I am getting access denied error while importing? Has it got something to do with IE7 version or with the input type="file" which is being used here?
Thanks for any help if anyone can provide.
Edited by: passionateforjava on Mar 4, 2009 2:18 AM

vishnuS1984 wrote:
Hi Friends,
I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class...So let's see... C:\GetMe1 is a directory on your machine, right? And this is what you are doing with that directory:
public static void copyFiles(File src, File dest) throws IOException
// dest is a 'File' object but represents the C:\GetMe1 directory, right?
fout = new FileOutputStream (dest);If it's a directory, where in your code are you appending the source file name to the path, before trying to open an output stream on it? You're not.
BTW, this is awful:
catch (IOException e)
IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
wrapper.initCause(e);
wrapper.setStackTrace(e.getStackTrace());
throw wrapper;
}1) You're hiding the original IOException and replacing it with your own? For what good purpose?
2) Even if you had a good reason to do that, this would be simpler and better:
throw new IOException("your custom message goes here", e);
rather than explicitly invokign initCause and setStackTrace. Yuck!

Similar Messages

  • Uploading a file using input type=file

    Hi,
    I'm not sure if I'm in the right place or not. If not can you please let me know where to find and answer for my question.
    I'm trying to upload a file in oracle self-service (online page) and I found that the input type=file will let me select the file so I place the input type inside my htp.formopen command.
    I used the following when opening the formopen
    htp.formOpen(my_link, 'post',null, 'multipart/form-data');
    then I created the <input type="file"> tag
    But when I send the link to my second page to see if the input type works I get the page not found error.
    I'm thinking that maybe is because my 2nd page doesnt have a parameter that will hold the file but right now I'm not sure how to declare the file variables.
    Do you have any idea what could be wrong?
    Thanks

    What does your form do when you submit it? Handling file uploads is a bit of a convoluted process. I'd recommend starting here for some guidance:
    http://docs.oracle.com/cd/B14099_19/web.1012/b14010/concept.htm#i1005985

  • Access Denied Error while accessing "Site Settings Access requests and invitations"

    Hi,
    I am getting Access Denied Error while accessing "Site Settings > Access requests and invitations" in SharePoint  2013 online. Currently I am the owner of the site and have "FULL CONTROL" access. I am able to access using
    site collection account. So, what permission I have to give my regular account to access this page?
    Thanks, Pal

    Hello,
    Have you recently changed the Owners group of the site collection or removed the user from the original owners group? 
    The reason I am asking is when the Access requests and invitations list are created, the permissions are given only to the default owners group at the time that the Access Request list was created.  If this "regular account" is not part of that owners
    group, the user will receive access denied.  Site Collection Admins always have permissions for the Access Request List.
    A workaround for the Access Denied issue is listed in the KB article http://support.microsoft.com/kb/2911390/en-us.  By giving the correct group or user the permissions to this list, the users will not receive
    the Access Denied issue anymore.  
    Preferably, in order to grant the user the full permissions ( you will see features like resending invitations may still fail after implementing the above workaround) there is one other workaround that may be required depending on what the original issue
    was.  Below are additional steps to restore full functionality.
    1)Access the /_layouts/15/permsetup.aspx of the site collection, make sure the default Owners Group
    is set correctly.  (There is a group selected)
    2) Add user to that Owners Group.  (Issue may be resolved at this step if the site collection Owners
    Group was never changed, if not continue to next step.)
    3) Implement workaround on http://support.microsoft.com/kb/2911390/en-us, by adding that owners
    group as Full control on Access Request list Permissions.
    Let me know how this works out for you.
    - Shpendi Jashari

  • Access denied error while writing a file to the file system - myfileupload.saveas() throws system.unauthorizedexception

    hi,
    as part of my requirement , i have to perform read and  write  operations of  few files [ using the file upload control in my custom visual web part] and on submit button click.
    but while writing these files - with the help of  fileupload control - and when i use  myfileupload.saveas(mylocation);
    - i am saving these files into my D:\ drive of my server , where i am executing my code -, am getting access denied error.
    it throws system.unauthorizedexception.
    i have given full control on that folder where i was trying to store my attached files. and also  after following asp.net forums,
    i have added  iusr group added and performed all those steps such that, the file is saved in my D:\ drive.
    but unfortunately  that didnt happen.
    also
    a) i am trying the code with runwithelevatedprivileges(delegate() )  code
    b) shared the drive within the  d :drive where i want o save the files.
    c) given the full privieleges for the app pool identity- in my case , its
    network service.
    the  other strange thing is that, the same code works perfectly in  other machine, where the same sp, vs 2012  etc were installed .
    would like to know, any other changes/ steps i need to make it on this  server, where i am getting the  error.
    help is  appreciated!

    vishnuS1984 wrote:
    Hi Friends,
    I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class...So let's see... C:\GetMe1 is a directory on your machine, right? And this is what you are doing with that directory:
    public static void copyFiles(File src, File dest) throws IOException
    // dest is a 'File' object but represents the C:\GetMe1 directory, right?
    fout = new FileOutputStream (dest);If it's a directory, where in your code are you appending the source file name to the path, before trying to open an output stream on it? You're not.
    BTW, this is awful:
    catch (IOException e)
    IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
    src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
    wrapper.initCause(e);
    wrapper.setStackTrace(e.getStackTrace());
    throw wrapper;
    }1) You're hiding the original IOException and replacing it with your own? For what good purpose?
    2) Even if you had a good reason to do that, this would be simpler and better:
    throw new IOException("your custom message goes here", e);
    rather than explicitly invokign initCause and setStackTrace. Yuck!

  • Timerjob Access denied error while opening web object

    Hi Team,
    I have created a timer job to get list information on the site. Everything is fine in the development(Stand alone server) . Got access denied error while running same timer job in QA server(one app and one WFE).
    Note: This timer job is globally deployed.
    Code snippet : 
    SPSite site1 = webApp.Sites[0];
    SPWeb web = site1.RootWeb;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    using (SPSite site = new SPSite(site1.ID))
    using (SPWeb currWeb = site.OpenWeb(web.ID))                  // Got access denied error here.
    Additional information:
    Sharepoint timer service account : Domain\SP_Farm
    Site app pool account : Domain\SP_App.
    Both accounts have site collection administrative access on the site. Do i need to check access permissions on DB level also  this error ?
    Waiting for urgent reply..

    Hi,
    1. Please check the link below:
    Fixing Access Denied Errors With SharePoint 2010 Timer Jobs
    http://www.sharepointsecurity.com/sharepoint/sharepoint-security/fixing-access-denied-errors-with-sharepoint-2010-timer-jobs/
    2. Try to set RemoteAdministratorAccessDenied  to false using PowerShell
    Access denied when deploying a timer Job or activating a feature from SharePoint 2010 content web application
    https://support.microsoft.com/kb/2564009?wa=wsignin1.0
    3. Check your ULS log for detail error message.
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Access denied Error while calling Web Service form Infopath Form 2010.

    Hi Dear All,
    I have been facing an error while calling an GetUserProfileByName() web service method from InfoPath 2010 from.
    i have FBA(Forms Base Authentication )configured . After Infopath form published to site collection when i select an user from people picker control i want to get Email Id of Selected user for that i am calling getUserProfileByName() Web Method, but 
    i am getting Access denied error code 500.
    Any Help would be more than welcome.
    Thanks.

    Hi,
    Greetings. Please check 
    Check the IE settings. Click Internet Options> Security>Custom level. Make sure that the ‘Access data source across domains’ is enabled. Make sure that you have permission to the web service and to the content which the web service tries to modify.
    For more information, please refer to this site:
    "Access is denied." error in Infopath 2007 form + ASMX: http://us.generation-nt.com/answer/access-denied-error-infopath-2007-form-plus-asmx-help-65808252.html
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • Two forests trusted "Access denied error" while RDP

    Hi Everybody,
    I have two forests 
    for ex:
    TestA & TestB
    I have created one Global group called "XYZ" in 'TestA' forest and added the users. 
    Both the forests are trusted. 
    In 'TestB' forest i have two servers. Computer1 & Computer2
    I have added "XYZ" group from "TestA" to Local administrators group of "TestB" and these groups are in restricted groups.
    Iam able to access upn \\computer1\C$ from TestA forest. But when i am trying to RDP to "Computer1" iam getting Access Denied error.
    Computer1 is (2008 R2) and forest & domain functional lever is 2003
    Kindly advise on this issue.
    Thanks!!

    Hi,
    I assume you don't have RDSH role installed.
    Have a look here
    This post is provided AS IS with no warranties or guarantees, and confers no rights.
    ~~~
    Questo post non fornisce garanzie e non conferisce diritti

  • How can i invoke a file chooser dialog box with out using input type=file

    how can i invoke a file chooser dialog box with out using <input type=file> can any one help me mail me to [email protected]

    You could use an applet...
    Or maybe Javascript has some way to do it.

  • Access denied error while exporting chart to excel

    I need to export data from a gridview to chart in excel. Through system account credentials it works fine. But through a user's credentials its giving an access denied error. The gridview data is exported properly but the current chart which is displayed
    on page is not getting displayed in excel.
    So is there any other way to achieve this?
    I was thinking og saving it to virtual folder in the Site but I cannot figure out the exact code for it. Since file upload control is not involved, how to save the chart to the virtual folder. Any inputs on this?

    Hello,
    Would you mind if you use "runwithelevatedprivileges" in your code to execute code with admin privilege?
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges.aspx
    >I was thinking og saving it to virtual folder in the Site
    Do you want to save excel in system folder or SP site folder?
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Access denied error while trying to install graphics drivers

    Hello,
    I have a new toshiba laptop P70-A. I have installed windows 7 and the pc was working excellent up until now. Noticed yesterday that the nvidia automated system failed to install the new update. When I tried to install the new driver manually, even from the
    device manager, I got the access denied message. 
    A day now wasted reading all the possible causes and solutions but with no luck. Read all the forums and all the posts, tried almost everything. Below youll find everything I tried as a solution and failed.
    1.Disabled UAC
    2.Enabled the administrator account and trying to take control from there
    3.Run the subinacl and the reset.cmd
    4.Tried manually to take control the folder windows (and access denied while changing the rights)
    5. Scanned the system with everything there is available ( Kaspersky, MalwareBytes, RegCurePro, Tuneup Utilities, CCleaner) The system came out clean.
    6. Tried restoring the system to an earlier time (got again access denied error code 0x80070005)
    7. Checked all the group policies (all seem to be fine)
    8. Run a script to take immediate ownership over all of C:
    TAKEOWN /A /F C:
    then the next one
    TAKEOWN /F C: 
    9. With subinacl I run all the above scripts... (still nothing changed)
    @echo off
    title Resetting ACLs...
    echo.
    echo Determine whether we are on an 32 or 64 bit machine
    echo.
    if "%PROCESSOR_ARCHITECTURE%"=="x86" if "%PROCESSOR_ARCHITEW6432%"=="" goto x86
    set ProgramFilesPath=%ProgramFiles(x86)%
    goto startResetting
    :x86
    set ProgramFilesPath=%ProgramFiles%
    :startResetting
    echo.
    cd /d "%ProgramFilesPath%\Windows Resource Kits\Tools"
    echo. 
    echo Resetting ACLs...
    echo (this may take several minutes to complete)
    echo. 
    echo IMPORTANT NOTE: For this script to run correctly, you must change
    echo the values named Athena to be the Windows user account that
    echo you are logged in with.
    echo.
    echo ==========================================================================
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=Athena=f /setowner=administrators > %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_CURRENT_USER /grant=administrators=f /grant=system=f /grant=restricted=r /grant=Athena=f /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_LOCAL_MACHINE /grant=administrators=f /grant=system=f /grant=users=r /grant=everyone=r /grant=restricted=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /subkeyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    subinacl /keyreg HKEY_CLASSES_ROOT /grant=administrators=f /grant=system=f /grant=users=r /setowner=administrators >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo System Drive...
    subinacl /subdirectories %ProgramFilesPath%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo Windows Directory...
    subinacl /subdirectories %windir%\ /grant=administrators=f /grant=system=f /grant=users=e >> %temp%\subinacl_output.txt
    echo. 
    echo. 
    echo ==========================================================================
    echo. 
    echo FINISHED.
    echo. 
    echo Press any key to exit . . .
    pause >NUL
    Im frustrated really... ANY help at all would be really appreciated.
    Thanks in Advance and sorry for the long post
    Athena 

    Hello,
    Thanks for the replies, i much appreciate it. I tried all of the above with no luck again. Safe mode allows me though to install drivers but thats reverting the moment im entering windows. Im always running commands and programs as a administrator or in
    the Admin enabled account.
    It seems the problem is solved today. Via tune up utilities I disabled most of the startup programs and services and it seems that 1 service is causing this issue. Although I havent played much with the disabled services but 3 remain to be checked. One of
    the three is causing this.
    Thanks again guys and Ill keep you posted about the soft. conflict.
    Athena

  • "general access denied error" while implementing out-of-process COM Server Implementation in Windows Phone 8.1

    I have a Service (.exe) where I was registering for my COM Component like below
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hres = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, 0);
    if (hres != S_OK)
    OutputDebugStringA("Security Descriptor not initialized");
    ITypeLib* pTypeLib;
    HRESULT hr_1 = LoadTypeLibEx(L"ServiceIdl.tlb", REGKIND_REGISTER, &pTypeLib);
    if (pTypeLib != NULL)
    pTypeLib->Release();
    RegisterServer(L"Service.exe", CLSID_classAImpl, L"ClassAImpl Sample", L"Component.ClassAImpl", L"Component.ClassAImpl.1", 0);
    g_hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
    DWORD reg = 0;
    IClassFactory *pIFactory = new classAFactory;
    HRESULT hr0 = CoRegisterClassObject(CLSID_classAImpl, pIFactory, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &reg);
    if (FAILED(hr0))
    OutputDebugStringA("classAImpl is not registered");
    CoUninitialize();
    exit(1);
    HRESULT hr1 = CoResumeClassObjects();
    if (hr1 == S_OK)
    OutputDebugStringA("classAImpl is Resumed Registering");
    WaitForSingleObject(g_hEvent, INFINITE);
    CloseHandle(g_hEvent);
    CoRevokeClassObject(reg);
    pIFactory->Release();
    CoUninitialize();
    From Client Code I am CreatingInstance  Like Below
    COSERVERINFO si;
    MULTI_QI qi;
    COAUTHINFO cai = { RPC_C_AUTHN_NONE, RPC_C_AUTHZ_NONE, 0, RPC_C_AUTHN_LEVEL_NONE, RPC_C_IMP_LEVEL_IMPERSONATE, 0, EOAC_NONE };
    si.dwReserved1 = 0;
    si.pwszName = L"\\\\localhost";
    si.pAuthInfo = &cai;
    si.dwReserved2 = 0;
    qi.pIID = &IID_classA;
    qi.pItf = NULL;
    qi.hr = 1;
    CoInitializeEx(NULL, COINIT_MULTITHREADED);
    HRESULT hr = CoCreateInstanceEx(CLSID_classAImpl, 0, CLSCTX_LOCAL_SERVER, &si, 1, &qi);
    hr returning error "general access denied error";

    I think we may run into the limitations mentioned in the remarks of CoCreateInstanceFromApp doc(show as below). If you can provide a repro project, I
    can give you more details about what happens.
    The CoCreateInstanceFromApp function reads class registrations only from Fusion contexts and manifests, and from the HKLM\SOFTWARE\Classes\CLSID registry hive.
    Only built-in classes that are supported in the app container are supplied. Attempts to activate unsupported classes, including all classes installed by 3rd-party code as well as many Windows classes, result in error code
    REGDB_E_CLASSNOTREG.
    The CoCreateInstanceFromApp function is available to Windows Store apps. Desktop applications can call this function, but they have the same restrictions as Windows Store apps.
    If you are trying to call some windows classes in your library, I will suggest you check how to create windows runtime out of process component by viewing
    this sample. This is what I usually do.
    To be honest, I did not try to implement the out of process COM component using the method you tried as we previsouly do on desktop. I will suggest you try to register a very simple library(like a signle class and single interface which returns an integer),
    and see if it will work.
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

  • Access denied error while uploading the document into document library which is associated with a content type

    hi,
     am trying to upload a document in a document library which is associated  with content types [ the content type contains 10 site columns and one of them is taxonomy field]. i added this content type in the document library.
    this document library is residing in a team site which is saved as a template and  based on this template i have created sub sites.
    and when i tried to upload a file to the doc lib, it throws me "access denied error".
    what may be went wrong .
    any help is  appreciated!

    Access denied indicates the user account uploading the file doesn't have access to the library, or sometimes it means there's already a document in the library with the same name that was never checked in. It's also possible that your template contains
    custom code that tries to do something that is not allowed.
    Kind regards,
    Margriet Bruggeman
    Lois & Clark IT Services
    web site: http://www.loisandclark.eu
    blog: http://www.sharepointdragons.com

  • Can't get parameter in struts when using input type="file"...?

    Hi everyone:
    Can the common html tag and struts tag be used together?I have an example:in jsp
    <html:form method="post" action="sendmail.do" enctype="multipart/form-data">
    <tr><td>MailTo:</td><td>
    <html:text property="mailto"/></td></tr>
    <tr><td>MailFrom:</td><td>
    <html:text property="mailfrom"/></td></tr>
    <tr><td>Subject:</td><td>
    <html:text property="title"/></td></tr>
    <tr><td>Content:</td><td>
    <html:textarea property="content" rows="7" cols="30"/></td></tr><tr><td>
    Attach:</td><td>
    <input type="file" name="myfile"/></td></tr><tr><td>
    <html:submit/><html:reset/>
    </td></tr>
    </html:form>
    In Action,I want to use the code "request.getParameter("myfile")" to get the file real path.But I always get "null".Why "request.getParamter("myfile")" is null although I choose a file in jsp?
    Can struts Tag and html Tag be use together?Thks

    Instead of the Request, you need to use MultiPart request in this case.
    This is because of the following statement you are using in the form tag. {enctype="multipart/form-data"}
    Hope it helps....

  • Problems with clearing files from input type="file"

    I'm using &lsaquo;input type="file".. to upload files in some javascript.
    The page containing the &lsaquo;input type="file".. is not reloaded, so data on the &lsaquo;input type="file".. is not cleared.
    I've done this with form.reset() in IE, which cleares files from &lsaquo;input type="file".., but this doesn't work in Firefox. The next time I try to submit a file two files are submitted.
    I've even tried to replace the &lsaquo;input type="file".. to clear all data, but if i replace it with a &lsaquo;input type="file".. with same id, the files is still there from before.
    So my question is, how do I clear files selected
    ''(Edited to make the HTML code display properly -TonyE)''

    The firmware/file system on the iPhone is locked unless you jailbreak your iPhone. The sync function via a USB cable and iTunes is the only way to add or retreive data unless your phone is jailbroken (and that is limited to music, movies, contacts, pictures, etc)
    There are applications in App Store which will create a file storage system on your iPhone and allow your PC to access those folders/files via WiFi network (iFiles is one, there are others)
    iBluetooth requires your phone to be jailbroken.
    You can use a bluetooth connection from iPhone to PC to play music only thru the PC speakers without having a jailbroken phone.
    If all you want to do is transfer pictures, iTunes will do that.  It is already set up, just plug in the phone, and go to the photos tab and choose which picture app on the PC to transfer the photos into.  Then everytime you sync your phone, it pulls the new pictures off the camera roll.
    What was I thinking when I bought an HP ?
    Oh yea, I wasn't !
    IQ504 & IQ506

  • Access denied error --  while copying file to a specific directory

    Hi Friends,
    I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class
    package ZipTest;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    public class TestCopy {
          * @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              File source = new File("C:\\mkyong\\test_1.txt");
              File desc = new File("C:\\GetMe1");
              try {
                   copyFiles(source,desc);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         public static void copyFiles(File src, File dest) throws IOException
         if (!src.exists())
         throw new IOException("copyFiles: Can not find source: " + src.getAbsolutePath()+".");
         else if (!src.canRead())
         throw new IOException("copyFiles: No right to source: " + src.getAbsolutePath()+".");
         if (src.isDirectory())
         if (!dest.exists())
         if (!dest.mkdirs())
         throw new IOException("copyFiles: Could not create direcotry: " + dest.getAbsolutePath() + ".");
         String list[] = src.list();
         for (int i = 0; i < list.length; i++)
         File dest1 = new File(dest, list);
         File src1 = new File(src, list[i]);
         copyFiles(src1 , dest1);
         else
         FileInputStream fin = null;
         FileOutputStream fout = null;
         byte[] buffer = new byte[4096];
         int bytesRead;
         try
         fin = new FileInputStream(src);
         fout = new FileOutputStream (dest);
         while ((bytesRead = fin.read(buffer)) >= 0)
         fout.write(buffer,0,bytesRead);
         catch (IOException e)
         IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
         src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
         wrapper.initCause(e);
         wrapper.setStackTrace(e.getStackTrace());
         throw wrapper;
         finally
         if (fin != null) { fin.close(); }
         if (fout != null) { fin.close(); }
    But i am getting the following errorjava.io.IOException: copyFiles: Unable to copy file: C:\mkyong\test_1.txttoC:\GetMe1.
         at java.io.FileOutputStream.open(Native Method)
         at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
         at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
         at ZipTest.TestCopy.copyFiles(TestCopy.java:68)
         at ZipTest.TestCopy.main(TestCopy.java:18)
    Caused by: java.io.FileNotFoundException: C:\GetMe1 (Access is denied)
         ... 5 more
    It would be really helpful to have your guidance.
    Thanks & Regards
    VS                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    vishnuS1984 wrote:
    Hi Friends,
    I have gone through scores of examples and i am failing to understand the right thing to be done to copy a file from one directory to another. Here is my class...So let's see... C:\GetMe1 is a directory on your machine, right? And this is what you are doing with that directory:
    public static void copyFiles(File src, File dest) throws IOException
    // dest is a 'File' object but represents the C:\GetMe1 directory, right?
    fout = new FileOutputStream (dest);If it's a directory, where in your code are you appending the source file name to the path, before trying to open an output stream on it? You're not.
    BTW, this is awful:
    catch (IOException e)
    IOException wrapper = new IOException("copyFiles: Unable to copy file: " +
    src.getAbsolutePath() + "to" + dest.getAbsolutePath()+".");
    wrapper.initCause(e);
    wrapper.setStackTrace(e.getStackTrace());
    throw wrapper;
    }1) You're hiding the original IOException and replacing it with your own? For what good purpose?
    2) Even if you had a good reason to do that, this would be simpler and better:
    throw new IOException("your custom message goes here", e);
    rather than explicitly invokign initCause and setStackTrace. Yuck!

Maybe you are looking for

  • Migrating from 6i to 9i for form generating starting with designer

    I try to migrating our forms generating 5-6 years start with designer, but they are finished through form builder. When I tried to use migrating assistant wizard, I get LMDMANA.CG$WHEN_NEW_FORM_INSTANCE: The String CALL was found. If it is an occuren

  • Can you have two iTunes accounts on same laptop for different iPads

    Can you set up a second Itunes account for a different person with a different iPad & iPod, I already have one but do not want other persons iPad sharing same apps and details etc How do I set up a new iTunes account for someone else without mucking

  • How can I add ring tones to my iPhone?

    How can I add ring tones to my iPhone? I just got an iPhone 5c and I am clueless about these things.

  • IPhone & JVC DAB Car Radio - advice

    Hi Guys & Gals, Can I seek your advice please? I have a JVC DAB car radio which has a USB connection for my iPod. Works fine when I connect my iPod, but I now have an iPhone 3GS. When I connect this to the head unit via the USB the iPhone doesn't rec

  • Font issues

    hello, I have a problem with Acrobat 8.2 not showing all letters of the same font (arial) in certain PDF's for some users.  The document is created on an application server using Java.  Only a few users have had this problem and I've narrowed it down