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 > Upload Images to website

Upload Images to website
Thread Tools
Junior Member
Join Date: May 2000
Status: Offline
Reply With Quote
Jan 8, 2004, 02:54 PM
 
I'm a total novice at anything webdesign related - but I'm fooling around with dreamweaver making my own hompage. It's is fairly easy making a web gallery from a image bank that you upload yourself (just using the Create Web Photo Album command)
But what I need to do is making it possible for people to upload images that will show on the webpage. How is this possible without to much coding which I know nothing about...

thanx
     
Forum Regular
Join Date: Mar 2003
Location: Minneapolis
Status: Offline
Reply With Quote
Jan 8, 2004, 09:41 PM
 
Originally posted by MacEgo:
I'm a total novice at anything webdesign related - but I'm fooling around with dreamweaver making my own hompage. It's is fairly easy making a web gallery from a image bank that you upload yourself (just using the Create Web Photo Album command)
But what I need to do is making it possible for people to upload images that will show on the webpage. How is this possible without to much coding which I know nothing about...

thanx
Your new best friend:



Gallery
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Jan 9, 2004, 08:37 AM
 
You can do this pretty painlessly in PHP as well. Here's some sample code.

First, the form:

[php]
<html>

<form enctype="multipart/form-data" action="upload_action.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
Send this file: <input name="userfile" type="file"> (50KB maximum)
<input type="submit" value="Send File">
</form>

</html>
[/php]

Second, the script that processes the form:

[php]
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES._ In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file

$uploaddir = '/Library/WebServer/Documents/uploads/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging infon";
print_r($_FILES);
} else {
print "Possible file upload attack!_ Here's some debugging infon";
print_r($_FILES);
}
print "</pre>";

?>
[/php]
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
-Q-
Moderator
Join Date: Jan 2001
Location: Atlanta, GA
Status: Offline
Reply With Quote
Jan 9, 2004, 02:16 PM
 
Originally posted by Arkham_c:
You can do this pretty painlessly in PHP as well. Here's some sample code.
Did you just say 'painless' and 'PHP' in the same sentence?
     
Senior User
Join Date: Dec 2002
Status: Offline
Reply With Quote
Jan 9, 2004, 02:42 PM
 
thats what the P stands for!
Travis Sanderson
     
MacEgo  (op)
Junior Member
Join Date: May 2000
Status: Offline
Reply With Quote
Jan 9, 2004, 04:43 PM
 
When I say I have no clue about web programming - I mean it! I've tried to just paste and copy the php code into dreamweaver..that didn't really just work (the first bit did - not the last)...gallery seems nice but actually also rather complex and my host server is in php Safe Mode - does that disqualify my from using php altogther or just Gallery?!

thanx
     
Forum Regular
Join Date: Mar 2003
Location: Minneapolis
Status: Offline
Reply With Quote
Jan 9, 2004, 05:29 PM
 
Originally posted by MacEgo:
When I say I have no clue about web programming - I mean it! I've tried to just paste and copy the php code into dreamweaver..that didn't really just work (the first bit did - not the last)...gallery seems nice but actually also rather complex and my host server is in php Safe Mode - does that disqualify my from using php altogther or just Gallery?!

thanx
I sometimes get that error aswell. Dont worry about it. Gallery is by far the most feature rich and likely the easiest program to use for your needs.

PM me and I will give you directions and examples if you need help
     
Dedicated MacNNer
Join Date: Oct 2000
Location: Copenhagen, Denmark
Status: Offline
Reply With Quote
Jan 18, 2004, 12:59 PM
 
It is possible to use an upload function even though php is in safe mode. I don't know Gallery, but if it creates the folder the pics/files are uploaded to, you can usually make it work if you delete the folder it have made and then, via ftp make a folder and call it the same name (and then of course CHMOD it correctly).
I hope the explanation makes sense

Peter
     
   
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 12:49 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