Closed Thread
Results 1 to 12 of 12

Thread: PHP Upload Help

  1. #1
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55

    PHP Upload Help

    Ok, the form is at this URL:

    http://vietcongworld.actionrealm.com/sub_you_mod2.htm

    The problem is that I thought if I put in a hidden redirect field in my form, it would redirect to that URL..nope. I uploaded a file, and was taken to a completely blank page. Checked my server and the file's been uploaded successfully, but, I want the uploader to be redirected to a specified URL other than that blank white page. Feel free to try it out but only 500KB and lower. Thanks in advance.

    Note: Never used PHP before this so I might not know some terms or whatever.

  2. #2
    Senior Member Salam is an unknown quantity at this point
    Join Date
    Aug 2002
    Location
    Tehran/IRAN
    Posts
    141
    Correct your Upload.php file :

    For example after move_uploaded_file() function (if exist), add
    header("Location: http://vietcongworld.actionrealm.com/upl.htm") ;

    If dosnt exist, see Upload.php's source and send the line which consists $HTTP_POST_VARS['redirect'] here . then I can tell you what is the problem .

  3. #3
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55
    Like I said I've never used PHP, so about 1/3 of that made sense. If you're asking for the code..Here..

    <?
    //the absolute location of where you want to upload it
    //the directory must be chmoded 777
    //jpgimage is the name from the top
    copy($mod, "/home/virtual/site113/fst/var/www/html/mods/$mod_name");
    unlink($mod);
    ?>

  4. #4
    Senior Member Salam is an unknown quantity at this point
    Join Date
    Aug 2002
    Location
    Tehran/IRAN
    Posts
    141
    Use this code as Upload.php :

    PHP Code:
    <?php
    move_uploaded_file
    ($HTTP_POST_FILES['mod']['tmp_name'], "/home/virtual/site113/fst/var/www/html/mods/".$HTTP_POST_FILES['mod']['name']) ;
    header("Location: ".$HTTP_POST_VARS['redirect']) ;
    ?>

  5. #5
    Pro Member hessan is an unknown quantity at this point
    Join Date
    Jun 2001
    Location
    San Diego
    Posts
    389
    salam salam
    !!

    gherti.com yadet nare

    whats up every one
    i know this post is really lame

  6. #6
    Senior Member Salam is an unknown quantity at this point
    Join Date
    Aug 2002
    Location
    Tehran/IRAN
    Posts
    141
    Originally posted by hessan
    salam salam
    !!

    gherti.com yadet nare

    whats up every one
    i know this post is really lame
    Salam ,
    Tarahiye sitetun jaleb bood .
    Please continue as Private Message .

  7. #7
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55
    Just to give this an end..

    I used the header (http://???); function.

  8. #8
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55
    Actually there's one more thing I need to ask.

    <?
    //the absolute location of where you want to upload it
    //the directory must be chmoded 777
    //jpgimage is the name from the top
    copy($mod, "/home/virtual/site113/fst/var/www/html/mods/$mod_name");
    unlink($mod);
    header ("Location: http://vietcongworld.actionrealm.com/upl.htm");
    ?>
    What do I need to add to this, and where, to have the REMOTE_ADDR logged in a .txt file?

  9. #9
    Senior Member Salam is an unknown quantity at this point
    Join Date
    Aug 2002
    Location
    Tehran/IRAN
    Posts
    141
    Add this before your header() function :
    PHP Code:
    $fp=fopen("remote.txt","a") ;
    fputs($fp$REMOTE_ADDR."\r\n") ;
    fclose ($fp); 

  10. #10
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55
    Thanks for all the help, but guess what, I need something else. That script successfully logs the IP's who upload, but is there anyway to include the name of the file along with the IP. Maybe looking something like this in the .txt file...

    127.0.0.1 johnnyb.zip

    If someone with the IP of 127.0.01 uploaded the file "johnnyb.zip." I was trying to figure how to incorporate the $mod into the IP logging script but I'm too new at this. Can I get some help one more time . Thanks.

  11. #11
    Senior Member Salam is an unknown quantity at this point
    Join Date
    Aug 2002
    Location
    Tehran/IRAN
    Posts
    141
    PHP Code:
    $fp=fopen("remote.txt","a") ;
    fputs($fp$REMOTE_ADDR." $mod_name\r\n") ;
    fclose ($fp); 
    If dosnt work :
    PHP Code:
    $fp=fopen("remote.txt","a") ;
    fputs($fp$REMOTE_ADDR." : ".$HTTP_POST_FILES['mod']['name']."\r\n") ;
    fclose ($fp); 
    Last edited by Salam; September 12th, 2002 at 14:42.

  12. #12
    Member kgkia33 is an unknown quantity at this point
    Join Date
    Jul 2002
    Posts
    55
    That's perfect. I used the second script. Thanks a lot, that should be the last of my help requests .

Closed Thread

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