DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> Photography Discussion >> A simple image upload error problem?
Pages:  
Showing posts 1 - 2 of 2, (reverse)
AuthorThread
01/26/2011 02:57:22 AM · #1
Hi,

This is probably a simple question, however I am finding it difficult to accomplish.

$upload = new upload();
$upload->upload_file();
?>

so in a test page it would be like so:

$upload = new upload();
$upload->upload_file();
?>






The problem is I'm using this upload system for parts of the website, what I want is to have this class upload the file once it has gone through the "gallery upload" segment:


$mysql_link = mysql_connect("localhost", "", "");
mysql_select_db("") or die("Could not select database");

while($counter <= count($photos_uploaded)) {
if($photos_uploaded['size'][$counter] > 0) {
if(!array_key_exists($photos_uploaded['type'][$counter], $known_photo_types)) {
$result_final .= "File ".($counter+1)." is not a photo
";
}
else {
mysql_query( "INSERT INTO gallery_photos(`photo_filename`, `photo_caption`, `photo_category`) VALUES('0', '".addslashes($photo_caption[$counter])."', '".addslashes($_POST['category'])."')" );
$new_id = mysql_insert_id();
$filetype = $photos_uploaded['type'][$counter];
$extention = $known_photo_types[$filetype];
$filename = $new_id.".".$extention;

mysql_query( "UPDATE gallery_photos SET photo_filename='".addslashes($filename)."' WHERE photo_id='".addslashes($new_id)."'" );
}

?>
How would I approach this PHP Image Gallery on the site: PHPKode (Upload Problem)?

Thanks

Message edited by author 2011-01-26 02:58:26.
01/26/2011 03:03:04 AM · #2
Kinda seems like the wrong forum to post the thread, but there are a few decent PHP devs on here as well.

I do want to say if this is publicly used, one thing I learned doing dynamic code for sites is, You will probably be attacked, more of a when then an if. So once you get this working don't forget to make security the next step, an uploader is a nice target. All the basics, stripping slashes and other code allowing syntax, validate that its an image file etc.
Pages:  
Current Server Time: 08/26/2025 12:38:05 PM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2025 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 08/26/2025 12:38:05 PM EDT.