Page 1 of 2

give description to a file

Posted: Tue May 18, 2004 8:56 pm
by merican
hi anyone,
I really need a help here. I want to give description to a file and upload it to apache server folder. below is the htm form that will 'action' will go to uploadit.php :-

<HTML>
<HEAD>
<TITLE>Upload example</TITLE>
</HEAD>
<BODY>
<form action="uploadit.php" method="post" enctype="multipart/form-data">
Select File to Save : <input type="file" name="thefile"><br>
<hr>


Department&nbsp; : <select size="1" name="Deparment">
<option>Diffusion</option>
<option>Implant</option>
<option>CMP</option>
<option>Q.A</option>
</select>
<p>Description : <input type="text" name="description" size="20"></p>
<p>


<input type="submit" value="Upload">&nbsp;&nbsp; <b><a href="file://Fileshare/FILE_SHARE/Operation/Fab%20Operation/Diffusion/Equipment%20Engineering/Heated%20line%20project/docu/index.htm">CANCEL</a></b>
</p>
</form>
</BODY>
</HTML>


can someone help me with the uploadit.php side. i really need to know how this can work. thank you in advance.
alfy

Posted: Tue May 18, 2004 9:10 pm
by feyd
please don't cross post.

uploadit.php will receive..

Code: Select all

$_POST['Deparment'] // with the selected index value, whichever that is.
$_POST['description'] // the string from description
$_FILES['thefile'] // if the upload succeeded.
once you get that, you can start placing the post data into a database, or a flat file.. or something..

Posted: Tue May 18, 2004 9:16 pm
by merican
hi feyd,
thank for reply. what do yopu mean by cross post? is it a kind of post from htm to php? can you please tell me more about the code?

thank you in advance.
regard,

alfy

Posted: Tue May 18, 2004 9:21 pm
by hawleyjr
Don't post the same question in two different forums:

viewtopic.php?t=21753

Posted: Tue May 18, 2004 9:23 pm
by feyd
cross posting is posting the same, or extremely similar thing in 2 or more forums. You posted this thread, and a thread in "Volunteer Work"

The code I posted was the variables that'd be set on submission to uploadit.php.

sorry..my fault

Posted: Tue May 18, 2004 9:25 pm
by merican
oppss..
that is my fault. sorry to all...never to that again. can anyone please tell me more on the script?

Posted: Tue May 18, 2004 9:28 pm
by merican
hi,
you mean that, that code must be put on the header of the uploadit.php? how about to upload the description to the same folder as the file uploaded? is there any code to add ?

regards,
alfy

Posted: Tue May 18, 2004 9:39 pm
by feyd
there's plenty of code to add. I'm trying to nudge you the right direction, not do it for you. There are many threads about upload scripts in the past few days in this forum, as well as a (mostly) ready-made script in the "Code Snippets" forum

Posted: Tue May 18, 2004 9:41 pm
by merican
i have the uplaod script only but to add description to the file is something new to me...please lead me to acheive that....thanks feyd

Posted: Tue May 18, 2004 9:48 pm
by feyd
k.. well .. if you want to just toss the description in a text file, then..

Code: Select all

$file = fopen("/same/path/as/where/you/place/the/uploaded/file/".basename($uploaded_file_name).".txt","wb") or die("unable to open description file");
fwrite($file,$_POST['description']);
fclose($file);

Posted: Tue May 18, 2004 9:57 pm
by merican
hi feyd,
the sample from the code snippets is quite understanable. but the problem is , when i published it on the apache, i did not come out. Must i edit the code first before publish it?

thank you in advance,
alfy

Posted: Tue May 18, 2004 9:58 pm
by feyd
it probably needs a bit of customization to your specific application before it's put out there, yeah.

Posted: Tue May 18, 2004 10:02 pm
by merican
hi feyd,
it say that "The GD library is of course needed for this " what thats mean? i use PHPTRIAD. does it support GD?

thak you in advance,
alfy

Posted: Tue May 18, 2004 10:04 pm
by feyd
if your current upload script works, I'd just use that.. and add similar code to the parts I posted with the fopen() function...

Posted: Tue May 18, 2004 10:54 pm
by merican
hi fyed,
i still cannot puublish the code snippets. but the good news is, i can create the description file(.txt) in the upload file. look forward to this problem.
thank you in advance.
regards,
alfy