Closed Thread Icon

Topic awaiting preservation: File uploading (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12359" title="Pages that link to Topic awaiting preservation: File uploading (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: File uploading <span class="small">(Page 1 of 1)</span>\

 
benev
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jan 2002

posted posted 08-12-2002 09:22

i have:
uprep.php:

if ($rep == "0") {
print "You must specify a file to upload";
}
else {copy($rep, "/**/****/$file_name");
unlink($rep);
}

which works fine.

Though i'm having a problem displaying the file that was uploaded, as a link on another page, which would be view.php .
I tried adding $file_name, and then $rep to the url, both don't work and view it as null.

How could i display uploaded files on a page without opening the (ftp)directory through the browser?
Thanks.

hkjhk

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 08-12-2002 12:43

first, you should really use
move_uploaded_file() for copying the uploaded file to the directory.
Than you might have to chmod() it in order to make it accessible for anyone (ie. a webbrowser).

Hoping this aids you in your quest,
Tyberius Prime

Edit: Fixing link ;-)

[This message has been edited by Tyberius Prime (edited 08-12-2002).]

benev
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jan 2002

posted posted 08-12-2002 19:09

The file copies its self to the given directory, no problem there. It's just viewing it, is whats the problem.

uprep.php is the code for uploading file.
uprep.html is the form to upload the file.

view.php is what takes the filename that was uploaded, and displays it.

That is what i'm having a problem with, view.php, i don't know how to display the file name, it dosn't show up even with the variable: $file_name , then i tried $rep. Anything i can do so people can view the filename on view.php?

hkjhk

DL-44
Maniac (V) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 08-12-2002 21:35

Did you try the chmod as TP suggested?






[This message has been edited by DL-44 (edited 08-12-2002).]

benev
Bipolar (III) Inmate

From: New Jersey, USA
Insane since: Jan 2002

posted posted 08-12-2002 21:55

Well, i was able to fix it, by putting the uploaded filename ($file_name) in a table, then onward from there. Though i'm curious, how would chmod fix this? All i wanted was the variable $file_name to display the given file name through the browser, I.E not it projecting just whatever is in the directory. I'm not arguing, just wondering :P.

hkjhk

« BackwardsOnwards »

Show Forum Drop Down Menu