objectis Posted July 22, 2007 Share Posted July 22, 2007 I have a php script which uploads images into the ftp, updates the database from where i can fetch the picture into webpages and also, creates thumbnails. problem is, it just allows me to upload 1 pic at a time. i've tried using this script and altering it, but the end user is in mac platform and is not able to use .net apps. is there a way i could modify this code so that multiple pictures could be uploaded at once, including the caption? thanks in advance. -SP <?php require_once("../admin/session.php"); require_once('../db/admin.lib.php'); require_once('../db/PropertiesQuery.php'); require_once('../db/PropertyPhotosQuery.php'); require_once('../db/SelectAttributesQuery.php'); require_once('../lib/pages.lib.php'); require_once('../members/PropertyPhotosCore.php'); $core = new PropertyPhotosCore(); $member = $core->isMember(); $memberID = $core->getMemberID(); $propertyID = intval($core->getWebValue('propertyID')); $photoID = intval($core->getWebValue('photoID')); $pq = new PropertiesQuery(); $noGo = "<h3>Oops!</h3><p class='errMsg'>You don't have the privileges required to edit photos for this property.</p>"; if ($memberID && $member && $photoID && $propertyID) { if (! $core->memberCanEditListing($propertyID, $memberID)) { $page = new MemberPage($noGo); $page->display(); exit; } $maxFileSize = 1024 * 1024 * 3; $core->setPropertyID($propertyID); //$usage = $core->getUsage(); //$links = $core->getNavLinks(); //$inPhotos = $core->getPropertyPhotos(); $heading = $core->getPhotoEditHeading(); $paq = new PropertiesAdminQuery(); $propertyRow = $paq->selectRow($propertyID); $ppq = new PropertyPhotosQuery(); $photoRow = $ppq->getPhotoRow($propertyID, $photoID); $photoIDs = $ppq->getPropertyPhotoIDs($propertyID); if (isset($photoRow['photoID'])) { // Photo Exists $photoFilePrompt = "To replace this photo, select a new file"; $photoCaption = $photoRow['photoCaption']; $priority = array_search($photoRow['photoID'],$photoIDs); $photoCount = $ppq->getPhotoCount($propertyID); $inHasPhoto = $core->getInputHidden('hasPhoto','yes'); // user relative url's as we are on secure server $photoURL = '..'. $core->getThumbPhotoURL($photoID); $propPhoto = "<img class='propertyPhoto' src='$photoURL' alt='Property Photo'/>"; } else { // New Photo $photoFilePrompt = "Select a photo file"; $photoCaption = $core->getWebValue('photoCaption'); $inHasPhoto = $core->getInputHidden('hasPhoto','no'); $priority = $photoCount = $ppq->getPhotoCount($propertyID) + 1; $propPhoto = ''; } $beginForm = $core->getBeginForm("photoProcess.php?propertyID=$propertyID&photoID=$photoID",'isValidPhotoEditForm(this)',true); $endForm = $core->getEndForm(); $inDirection = $core->getInputHidden('direction',$priority); $inPhotoID = $core->getInputHidden('photoID',$photoID); $inPropertyID = $core->getInputHidden('propertyID',$propertyID); $inPhoto = $core->getInputFile('photoFile'); $inMaxFileSize = $core->getInputHidden('MAX_FILE_SIZE',$maxFileSize); $inCaption = $core->getInputTextArea('photoCaption',$photoCaption,1,48); $sa = new SelectAttributesQuery(); $inPriority = $sa->getPhotoPrioritySelect('priority',$priority,$photoCount); $submit = $core->getInputSubmit("Upload"); $cancel = $core->getCancelButton("javascript:location=\"photos.php?propertyID=$propertyID\""); $msg = $core->getWebValue('msg'); if ($msg != '') { $msg = "<h3>Oops!</h3><h4>There was a problem updating your photo: <span class='errMsg'>$msg</span></h4>\n"; } $mainContent = " <h2>$heading</h2> $msg <div id='photoForm' style='display:block;'> $beginForm <div class='propertyPhoto'> $propPhoto <h4>$photoFilePrompt</h4> $inPhoto <h4>Enter a caption that describes the photo</h4> <p style='margin:0;padding:0;'> $inCaption $inMaxFileSize $inPropertyID $inPhotoID $inHasPhoto $inDirection </p> <h4>Photo Position $inPriority</h4> Lower position numbers appear first in listings and slideshows. To move a photo, change its position number. <p> $submit $cancel </p> </div> $endForm </div> <div id='pleaseWait' style='display:none;'> <h3 class='errMsg'>Please wait !</h3> <p class='msg'>Your photo edit is being processed. Depending on the size of your photo file and the speed of your Internet connection, this may take a few minutes... <br /><br /> Thank you.</p> </div> "; $page = new MemberPage($mainContent); $page->display(); } else { $core->showMemberLoginPage(); } ?> Link to comment https://forums.phpfreaks.com/topic/61193-multiple-pic-upload-from-php/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.