Ezilon.com - Target Your Audience, be Seen in Your Region

uploading files

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 71 posts

Joined: Oct 2005

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.

Danny G Guillory Jr
danny@qbased.com
337.303.6453

Busy's picture
Modrater

He has: 6,157 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.

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

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.

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

Busy's picture
Modrater

He has: 6,157 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

<?bhb if(broken){ echo("It wasn't me Smiling "); } ?>
Learn HTML the ez way - EzHTML.net

Some people are like slinkies, they dont really serve any purpose but they still bring a smile to your face when you push them down the stairs ...

He has: 31 posts

Joined: Jan 2004

i would get it by using time..

<?php
echo date("mHiyd");
?>

thanks again for your help..

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..