Re: [PHP] picture upload within a form
On Friday 19 October 2007 10:34:28 Ronald Wiplinger wrote: > I have a form, where I upload a picture and a corresponding text. this far I'm with you > > > Is it possible to have a form (upload picture) within a form (text)? > As I have it now, the submit button just does nothing. here you escapes me. A form inside a form, or two forms or orororor something? "the" submit button, witch one is that? you want the image to be uploaded into the likes of webmail systems; sort of like a temporary remote storage for further execution? > > bye > > Ronald -- Børge Holen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] picture upload within a form
I have a form, where I upload a picture and a corresponding text. Is it possible to have a form (upload picture) within a form (text)? As I have it now, the submit button just does nothing. bye Ronald -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] picture upload
William Stokes wrote: Hello, I'm building a web site for a sports team. I wan't them to be able to update their own site so I need to build a file upload system for their pictures. Pictures also need to resized to fit their spot in the web page. Any ideas or quidelines how to do this. I've never done this kind of stuff before. Thanks IA William how to handle file uploads with PHP is described very well in the manual. Once you get past that stage just search google for php image upload. -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] picture upload
William Stokes wrote: > Hello, > I'm building a web site for a sports team. I wan't them to be able to > update > their own site so I need to build a file upload system for their pictures. > Pictures also need to resized to fit their spot in the web page. Any ideas > or quidelines how to do this. I've never done this kind of stuff before. > Thanks IA For the file upload part, the PHP Manual has a section (before all the functions) about how to do that. Read it. Try it. Post if you get stuck. :-) Don't forget the ENCTYPE part!!! For scaling the image, there are several options. One is to force the user to only submit images that fit within a certain size/parameters. This is probably good to avoid people uploading HUGE image files. You also should add some code in your file upload to be *SURE* it *is* a valid image, so your server does not become a clearing-house for the latest cracked version of Doom or whatever is popular this week. This function will be especially useful: http://php.net/getimagesize Once you have the file uploaded, you could scale it right away, once, and save the scaled version for use from then on. Or, you could scale the image each time, on the fly. The first option is more efficient. The second is more flexible if you want to change the image size later, or if you want to have thumbnails in one page, and full-size in another. (You can write one script to handle both) Your two main choices for scaling an image are: GD, which has to be installed with PHP (use http://php.net/phpinfo to check) ImageMagick (aka 'convert') which is a shell command you can install and use http://php.net/exec to execute. There are examples of using GD to scale images, and of using ImageMagick (aka convert) to scale images with exec all over the 'net, so I won't try and repeat them here. Oh yeah: Sooner or later, somebody will upload an image that's too SMALL. Don't try to scale it "up" -- That will be butt ugly. Just display it centered in the spot where the image belongs. Test this with a tiny image for yourself. Security Note: The directory where your uploaded images are stored should *NOT* be in your htdocs web tree. You can use PHP to make sure the image is kosher and *move* it after you check to the web tree. Or you can use PHP to check/read/display the image, so it's never in your web-tree. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] picture upload
Hello, I'm building a web site for a sports team. I wan't them to be able to update their own site so I need to build a file upload system for their pictures. Pictures also need to resized to fit their spot in the web page. Any ideas or quidelines how to do this. I've never done this kind of stuff before. Thanks IA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] picture upload error!
I can't upload picture to MySQL database: What is wrong with my script: I use PHP & MySQL database. After submiting form my script says that everything is OK, but in database I see that a picture is not uploaded.(date, size, name, type are inputed, but data is not!). Table: CREATE TABLE pictures ( picture_id int(11) DEFAULT '0' NOT NULL, name varchar(30) NOT NULL, date datetime DEFAULT '-00-00 00:00:00' NOT NULL, pic_data mediumblob NOT NULL, pic_size int(11) DEFAULT '0' NOT NULL, pic_type varchar(30) NOT NULL, PRIMARY KEY (picture_id) ); My PHP page: query($aSQL); if ($aDB->next_record() ) { $aNewID=$aDB->f("new_id"); } if(empty($aNewID) == True) { $aNewID=1; } $aSQL="insert into pictures (picture_id, name, ". "date, pic_data, "; $aSQL .="pic_size, pic_type) values ($aNewID, ". "'$PicName', "; $aSQL .= "NOW(), '$aFileContents', '$PicFile_size', ". "'$PicFile_type' )"; print($aSQL); $aDB->query($aSQL); if ($aDB->Errno != 0) { $aErrors = True; } } else { $aErrors= True; } } else { $aErrors = True; } if ($aErrors == False) { print("OK"); } else { print("ERROR!!!"); } ?> - - Ðurovski Dejan [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php