give description to a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

give description to a file

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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..
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

Don't post the same question in two different forums:

viewtopic.php?t=21753
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

sorry..my fault

Post by merican »

oppss..
that is my fault. sorry to all...never to that again. can anyone please tell me more on the script?
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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);
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it probably needs a bit of customization to your specific application before it's put out there, yeah.
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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...
merican
Forum Newbie
Posts: 22
Joined: Tue May 18, 2004 8:56 pm

Post 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
Post Reply