Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Uploading files?

Uploading files?
Thread Tools
Senior User
Join Date: Feb 2005
Location: Mississippi
Status: Offline
Reply With Quote
Dec 14, 2005, 12:52 PM
 
Hey guys I am building a website and the clients wants the ability for customers to upload their pictures to the website. I was wondering if any of you had a php java or whatever that could tell me how to do this? basically like myspace where you can upload pics to the site and see it automatically....


thanks guys,
     
Senior User
Join Date: Jul 2004
Status: Offline
Reply With Quote
Dec 15, 2005, 05:20 PM
 
the only one i know of is one that i use on one of my sites.

http://mip.lordsofclantribe.com/modu...=File_Uploader

you might be able to rip it out of phpnuke type of coding and get it to work if you would want to use that.
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Dec 15, 2005, 08:03 PM
 
this is pretty simple in php, as long as the server supports it.

you make a form that looks basically like this:
[HTML]
<form method='post' enctype='multipart/form-data' action='[some page].php'>
<input type='file' name='thefile' value=''>
<input type='submit name='submit' value='submit'>
</form>
[/HTML]

then on the [some page] you need something similar to:
[PHP]
<?
if(is_uploaded_file($_FILES['thefile']['tmp_name'])==true) { //make sure it uploaded
$extension=strtolower(ereg_replace(".*/","",$_FILES['thefile']['type'])); // type will be like 'image/gif' or 'image/jpg'
if($extension!='gif' &&$extension!='jpg' &&$extension!='png') {
die('not a valid image');
}
move_uploaded_file($_FILES['thefile']['tmp_name'],'pictures/'.$_FILES['thefile']['name'].".".$extension) or die('failed to move file');
// then you can open the image in GD to make sure it's a valid image, and not an exe or something like that
}
?>
[/PHP]
     
Mac Enthusiast
Join Date: Jul 2003
Status: Offline
Reply With Quote
Dec 20, 2005, 01:24 PM
 
I found an easy to use file file upload script. It does not put the files on automatically, but it will upload to your server, send you (or the admin) an email telling you there is a file waiting, and you can then put the pic wherever you want.

You can also use a wiki.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 07:46 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2