uploading files
i want to have a section of my site where users can upload files.
anyone know how i can achive this effect!
i am currectly using HTML code.
i want to have a section of my site where users can upload files.
anyone know how i can achive this effect!
i am currectly using HTML code.
Busy posted this at 20:10 — 27th January 2006.
He has: 6,151 posts
Joined: May 2001
You'll need some server side code ideally (PHP, ASP, CF etc)
HTML can create the form but not the transfer or validation of the upload. Then you may also need a database to store the uploaded file names etc.
Does your host allow server side scripting? If so which.
iTEAM.net posted this at 04:10 — 28th January 2006.
He has: 1 posts
Joined: Jan 2006
Here's a free script you can try:
http://tech.tailoredweb.com/simple-upload-53.php
Filesize limits will depend on your hosts php.ini.
mullet posted this at 14:30 — 18th February 2006.
He has: 31 posts
Joined: Jan 2004
hi i used something similar but one problem i have is if a user uploads a file with the same name as an existing file it other writes.. how can the you change the names so the file name is like 768946975.jpg instead of me.jpg?
the code i use is
-----------------------------------
<?php
$target_path = "images1/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "<b>The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded</b>";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
----------------------------------
the images1/ is the upload directory. the user then fills out title and description in a form and things like date, file id are hidden fields with echo of necessary info.
any help would be grateful
thanks Mullet
http://www.totalsmudge.co.uk
http://www.13outlaws.net
Busy posted this at 21:03 — 18th February 2006.
He has: 6,151 posts
Joined: May 2001
depends where the 768946975 comes from, is it the user's id, time, random number ...
http://php.net/manual/en/function.move-uploaded-file.php
mullet posted this at 23:12 — 18th February 2006.
He has: 31 posts
Joined: Jan 2004
i would get it by using time..
<?php
echo date("mHiyd");
?>
thanks again for your help..
mullet posted this at 13:31 — 26th February 2006.
He has: 31 posts
Joined: Jan 2004
i just need any way to rename the file either by adding the username to file like user_image.file_type or just a random code like 45h78s760i87.gif. i still using the code above
any help please..
http://www.totalsmudge.co.uk
http://www.13outlaws.net
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.