Results 1 to 11 of 11

Thread: Upload of a file to server

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Upload of a file to server

    Friends,

    I want to upload document file from local pc to server pc(IIS server). I am working in a domain. I am unable to do the job.

    For your help I use System.IO.File.Copy() function.

    When I am using local path like

    C:\Folder_Name\File_Name.pdf it is working fine.

    But When I am using

    \\PC-4\Folder_Name\File_Name.pdf it is not working.

    Please help me. I need urgently.


    Rajib
    Please Rate every reply if it is useful to u

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Upload of a file to server

    What error message does it show? And do you access to the Folder that you mentioned? File.Copy() should work properly if you have access to the specified folder.

    In case you want to upload a File to a Web Server then you should take a look at UploadFile method of System.Net.WebClient class
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Upload of a file to server

    Thanks for ur quick response.

    Yes, I have full access to the folder. But still it is not working.

    Actually from my local PC it is accessing C:\...... correctly

    But it is not getting \\PC-4\................

    How can I write the address of the server?

    -Rajib
    Please Rate every reply if it is useful to u

  4. #4
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Upload of a file to server

    Can you post the code that you are using? And is this share mapped on your PC?
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Upload of a file to server

    Is your application using identity impersonation? If not, then you need to grant the ASP.NET Worker Process permissions on that folder.

    Go to PC-4, and grant full permissions to YOURMACHINE\ASPNET on that folder.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Upload of a file to server

    Now I can copy files from my PC to server/Another PC successfully by using ASP.NET

    Now problem is file dependent. For example, A.pdf is working but B.pdf is not working. Do I need anything in the files. If u have any clu please help me.

    Rajib
    Please Rate every reply if it is useful to u

  7. #7
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Upload of a file to server

    Explain 'not working'.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Mar 2005
    Location
    Dhaka, Bangladesh
    Posts
    102

    Re: Upload of a file to server

    Mendhak,

    Actually when I try to upload from my form. It is running well. But when I go the directory where the files are uploaded, I found that some files are there and some files were lost that means those are not in the folder.

    I have found a clu. If I tried to load a scanned file, it is not uploding correctly. But If I upload a real PDF file it is working well. May be it can be a reason. If u have any clu please help me.

    Rajib
    Please Rate every reply if it is useful to u

  9. #9
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Upload of a file to server

    I may not have a "clu" but I might have a clue.

    I don't know the difference between your scanned files and 'real' PDF files, but go into debug mode. Set a breakpoint in the method which handles the uploaded file and step through it. Make sure you are catching exceptions. You may also want to do quickwatches on the uploaded file to see if its size is 0.

  10. #10
    Member
    Join Date
    Aug 2001
    Location
    Ottawa
    Posts
    38

    Re: Upload of a file to server

    You should also check the size of the scanned file you are uploading. If it exceeds the default 4Megs, the server will not allow the file to be uploaded.

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Upload of a file to server

    Good call, I forgot about that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width