Anyone know a good file upload routine.

This is a discussion on Anyone know a good file upload routine. within the C Programming forums, part of the General Programming Boards category; Hi, just looking for a little piece of C code (cgi script) that can handle a simple file upload to ...

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    25

    Anyone know a good file upload routine.

    Hi,
    just looking for a little piece of C code (cgi script) that can handle a simple file upload to a server from a browser. Or does anyone know of any general library for such tasks,

    Thanks in advance,
    Brett

  2. #2
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    cgi and C code are different in syntax and their operations, try looking at some server side langs like cgi and php.
    You can also do it directly from html, though i wouldnt recommend this - also if its not your own server you may find security restrictions stop you from such upload scripts
    Monday - what a way to spend a seventh of your life

  3. #3
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,786
    HTML does have a file upload control

    Code:
    <FORM ACTION="http://myserver.com/cgi" 
       ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="MyFile">
    </FORM>
    When the submit button is pressed, the file is POST'ed to the server. It is recieved and then must be decoded as it is recieved with the MIME type "multipart/form-data". Do a search to find more on this encoding. I do it in Java, and the decoding class has already been written (borrowed )

    The problems you have;

    1. Getting a decent decoding program to multitask and actually work on your server

    2. As Iain said - Getting your server to allow uploads. Many hosts dont like it

    3. Security - be very carefull what files you allow up and where you save them. It would be a shame for you to get this up and running only for some kiddie to upload a script and then run it

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 01:53 AM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21