Results 1 to 3 of 3

 

Thread: Upload a file and save the name in a db

  1. #1
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts


    That's all I need to do - I can upload the image really easily, or add the name to a db, but not both at the same time and it's driving me bonkers!

    I really need to validate it as well for certain file types and add other info into the db along with it but that's another job for another day at the moment.

    Anyone got any suggestions?
    Cheers,
    Steve

  2. #2
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts
    Thought someone might find this useful - a multiple file upload script that could be configured with variables passed from a form, but there is absolutely no security or even validation so use with caution.
    Still no closer to what I need though


    PHP Code:
    <html>
    <head>
    </head>
    <body>
    <center>
    <font color=blue size=2>
    <!-- unprotected image upload. No security or validation. Use with caution -->
    <font face=verdana size=2 color =blue> Copy objects from local computer to remote server</font>
    <?php
    set_time_limit
    (600);
    $numoffile 10
    // Fix path of your file to be uploaded
    $file_dir "uploads/"// folder name for uploaded file
    if ($_POST) { 
    for (
    $i=0;$i<$numoffile;$i++) { 
    if (
    trim($_FILES['myfiles']['name'][$i])!="") { 
    $newfile $file_dir.$_FILES['myfiles']['name'][$i]; 
    move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile); 
    $j++; 



    if (isset(
    $j)&&$j>0) print "<br>Object(s) has been uploaded.<br>"
    print 
    "<form method='post' enctype='multipart/form-data'>"
    for(
    $i=0;$i<$numoffile;$i++) { 
    print 
    "<input type='file' name='myfiles[]' size='30'><br>"

    print 
    "<br><input type='submit' name='action' value='Copy Files'>"
    print 
    "</form>"

    ?>
    </font>
    </body>
    </html>
    edit:spelling

  3. #3
    lowndsy's Avatar
    Dark Prince

    Status
    Offline
    Join Date
    Aug 2003
    Location
    Behind you
    Posts
    1,824
    Thanks
    7
    Thanked 44 Times in 33 Posts
    Thankyou for joining me on my file upload adventure. I think i might nearly be there with this one:

    http://www.phpbuddy.com/article.php?id=11



Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Affiliates promote spyware/adware free file sharing software and removal
    By Supercod in forum Best Practice & IAB Affiliate Council
    Replies: 207
    Last Post: 01-11-07, 04:50 PM
  2. unable to restore backup file in PLESK
    By ukyellowpage in forum Web Hosting & Security
    Replies: 0
    Last Post: 10-05-05, 02:26 AM
  3. Spybots Spambots & .htaccess
    By will 68 in forum Programming
    Replies: 6
    Last Post: 05-04-05, 11:12 PM
  4. How do I Attach an image file!
    By lewis_coburn in forum Affiliate Marketing Lounge
    Replies: 7
    Last Post: 31-01-05, 01:29 PM
  5. Downloading a file using PHP
    By wibble99 in forum Programming
    Replies: 10
    Last Post: 19-01-04, 01:15 PM

Bookmarks

Posting Permissions

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

Content Relevant URLs by vBSEO 3.5.0 RC2