uploading file


i creating upload form.  1 of fields file.  not seem working though.  file not being uploaded.  here code:

 

form:

<input type="file" name="upload" id="upload" size="48" value="<?php if($flag) { echo $_files['file']['name']; } ?>" />

 

php:

move_uploaded_file($_files["upload"]["tmp_name"], "http:/mysite.com/uploads/");

 

anything i'm missing?

you're missing giving file name.

 

move_uploaded_file($_files["upload"]["tmp_name"], "http:/mysite.com/uploads/" . $_files['upload']['name']);

 

also, i'm puzzled this:

 

value="<?php if($flag) { echo $_files['file']['name']; } ?>"

 

why trying insert value? , shouldn't $_files['upload']['name'] instead of $_files['file']['name']?



More discussions in Develop server-side applications in Dreamweaver


adobe

Comments