PHP - Upload Image Does Not Work :(
Hello everyone!
I'm working on a form that can upload an image on server and add the image name on mysql db. The add page works correctly, the image is uploaded correctly and the image name is inserted on the db. But, the edit page dows not work ... When i click on Send option on the edit page and i'm not adding any image, the image db field remains black, and, when i want to upload an image (change the image) via the edit page form, the image is not uploaded and the image db field remains blabk Can you help me please? add page <? include('header.php'); include ('includes/uploader.class.php'); $uploader = new uploader(); // Setting properties then Uploading the image $uploader->destDir = "D:/Program Files/VertrigoServ/www/oldi/imazhet/artikuj/"; $uploader->upload($_FILES['LajmeImg']); echo '<div class="majtas">'; // Remember any variables incase the form validation finds errors. $LajmeEmri = $_POST['LajmeEmri']; $KatLajmeID = $_POST['KatLajmeID']; // Kategoria Lajmeve $LajmeIntro = $_POST['LajmeIntro']; $LajmeTxt = $_POST['LajmeTxt']; $LajmeAktiv = $_POST['LajmeAktiv']; $LajmeTag = $_POST['LajmeTag']; $LajmeVideo = $_POST['LajmeVideo']; //$LajmeImg = $_FILES['LajmeImg']['name']; // Me autoName = False; regjistron ne db emrin real te fotografise $LajmeImg = $uploader->source['name']; // Me autoName = true; regjistron ne db emrin random te fotografise i gjeneruar ne base64 $LajmeLink = preg_replace("#[^a-z0-9\-_]#i", "",str_replace(' ', '_', $LajmeEmri)); // Ben Url automatikisht nga titulli (LajmeEmri) i lajmit if(isset($_POST['add_lajme'])) { $LajmeEmri = $_POST['LajmeEmri']; $KatLajmeID = $_POST['KatLajmeID']; // Kategoria Lajmeve $LajmeIntro = $_POST['LajmeIntro']; $LajmeTxt = $_POST['LajmeTxt']; $LajmeAktiv = $_POST['LajmeAktiv']; $LajmeTag = $_POST['LajmeTag']; $LajmeVideo = $_POST['LajmeVideo']; //$LajmeImg = $_FILES['LajmeImg']['name']; // Me autoName = False; regjistron ne db emrin real te fotografise $LajmeImg = $uploader->source['name']; // Me autoName = true; regjistron ne db emrin random te fotografise i gjeneruar ne base64 $LajmeLink = preg_replace("#[^a-z0-9\-_]#i", "",str_replace(' ', '_', $LajmeEmri)); // Ben Url automatikisht nga titulli (LajmeEmri) i lajmit if(trim($KatLajmeID) == '0') { $error = '<div class="error_message">Attention! Nuk ke zgjedhur kategorine.</div>'; } else if(trim($LajmeIntro) == '') { $error = '<div class="error_message">Attention! Nuk ke vene Intro.</div>'; } else if(trim($LajmeEmri) == '') { $error = '<div class="error_message">Attention! Nuk ke vene emrin.</div>'; } $count = mysql_num_rows(mysql_query("SELECT * FROM lajme WHERE LajmeLink='".$LajmeLink."'")); if($count > 0) { $error = '<div class="error_message">Ky emer/url gjendet ne database.</div>'; } if($error == '') { $sql = "INSERT INTO lajme (KatLajmeID, LajmeEmri, LajmeLink, LajmeIntro, LajmeTxt, LajmeAktiv, LajmeTag, LajmeVideo, LajmeImg) VALUES ('$KatLajmeID', '$LajmeEmri', '$LajmeLink', '$LajmeIntro', '$LajmeTxt', '$LajmeAktiv', '$LajmeTag', '$LajmeVideo', '$LajmeImg')"; $query = mysql_query($sql) or die("Fatal error: ".mysql_error()); echo "<h2>Success!</h2>"; echo "<div class='success_message'>U Shtua me sukses lajmi <b>$LajmeEmri</b> ne kategorine <b>$KatLajmeID</b> .</div>"; echo "<h2>Te Dhenat e Lajmit</h2>"; echo "<ul class='success-reg'>"; echo "<li><span class='success-info'><b>Titulli</b></span>$LajmeEmri</li>"; echo "<li><span class='success-info'><b>Url</b></span>$LajmeLink</li>"; echo "<li><span class='success-info'><b>Kategoria</b></span>$KatLajmeID</li>"; echo "<li><span class='success-info'><b>Aktive</b></span>$LajmeAktiv</li>"; echo "</ul>"; echo "<h2>Cfare deshiron te besh tani?</h2><br />"; echo "Shko tek <a href='lajme_edit.php'>modifikimi i lajmeve</a>.</li>"; } } if(!isset($_POST['add_lajme']) || $error != '') { echo $error; ?> <h2>Shto Lajme</h2> <form action="" method="post" enctype="multipart/form-data"> <label style="width: 28%;" for="KatLajmeID">Kategoria</label> <select id="KatLajmeID" name="KatLajmeID" size="1"> <?php $query="SELECT * FROM lajme_kategori "; $result=mysql_query($query); $num = mysql_num_rows ($result); mysql_close(); ?> <option selected value="0">Perzgjidh Kategorine</option> <? if ($num > 0 ) { $i=0; while ($i < $num) { $LKatID = mysql_result($result,$i,"LKatID"); $LKatEmri = mysql_result($result,$i,"LKatEmri"); $LKatLink = mysql_result($result,$i,"LKatLink"); $LKatAktiv= mysql_result($result,$i,"LKatAktiv"); ?> <option value="<?php echo $LKatID ?>"><?php echo $LKatEmri ?></option> <?php ++$i; } } ?> </select> <script type="text/javascript"> function toggle_LajmeLink(LajmeID) { if (window.XMLHttpRequest) { http = new XMLHttpRequest(); } else if (window.ActiveXObject) { http = new ActiveXObject("Microsoft.XMLHTTP"); } handle = document.getElementById(LajmeID); var url = '../ajax.php?'; if(handle.value.length > 0) { var fullurl = url + 'do=check_LajmeEmri_exists&LajmeEmri=' + encodeURIComponent(handle.value); http.open("GET", fullurl, true); http.send(null); http.onreadystatechange = statechange_LajmeEmri; }else{ document.getElementById('LajmeEmri').className = ''; } } function statechange_LajmeEmri() { if (http.readyState == 4) { var xmlObj = http.responseXML; var html = xmlObj.getElementsByTagName('result').item(0).firstChild.data; document.getElementById('LajmeEmri').className = html; } } </script> <label>Titulli</label><input type="text" name="LajmeEmri" value="<?=$LajmeEmri;?>" onchange="toggle_LajmeEmri('LajmeEmri')" width="70%" /><br /> <label>Intro</label><textarea id="LajmeIntro" name="LajmeIntro" value="<?=$LajmeIntro;?>"></textarea> <script type="text/javascript"> CKEDITOR.replace( 'LajmeIntro', { filebrowserBrowseUrl : 'includes/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Images', filebrowserFlashBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Flash', filebrowserUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', filebrowserImageUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', filebrowserFlashUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' }); </script><br /> <label>Lajmi</label><textarea id="LajmeTxt" name="LajmeTxt" value="<?=$LajmeTxt;?>"></textarea> <script type="text/javascript"> CKEDITOR.replace( 'LajmeTxt', { filebrowserBrowseUrl : 'includes/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Images', filebrowserFlashBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Flash', filebrowserUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', filebrowserImageUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', filebrowserFlashUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' }); </script><br /> <label>Fotografia</label> <input type="file" size="20" value="<?=$LajmeImg;?>" id="LajmeImg" name="LajmeImg" /><br /> <label>Video</label><textarea id="LajmeVideo" name="LajmeVideo" value="<?=$LajmeVideo;?>" rows="4" wrap="soft" style="width:700px;" /></textarea><br /> <label>Tag</label><input id="LajmeTag" type="text" name="LajmeTag" value="<?=$LajmeTag;?>" /><br /> <label>Aktive</label><input id="LajmeAktiv" name="LajmeAktiv" type="checkbox" value="PO"><br /> <input type="submit" value="Vazhdo" name="add_lajme" /> </form> <? } echo '</div>'; include('poshte.php');?> edit page <?php include('header.php'); include ('includes/uploader.class.php'); $uploader = new uploader(); // Setting properties then Uploading the image $uploader->destDir = "D:/Program Files/VertrigoServ/www/oldi/imazhet/artikuj/"; $uploader->upload($_FILES['LajmeImg']); echo '<div class="majtas">'; if(!$_GET['lajmeid'] && !isset($_POST['do_edit']) && !isset($_POST['edit_lajme'])) { echo $error; // Shfaq listen e lajmeve lajmet_lista(); } // Has the edit form been submitted? if(isset($_POST['do_edit'])) { $LajmeID = $_POST['LajmeID']; $LajmeEmri = $_POST['LajmeEmri']; $KatLajmeID = $_POST['KatLajmeID']; // Kategoria Lajmeve $LajmeIntro = $_POST['LajmeIntro']; $LajmeTxt = $_POST['LajmeTxt']; $LajmeAktiv = $_POST['LajmeAktiv']; $LajmeTag = $_POST['LajmeTag']; $LajmeVideo = $_POST['LajmeVideo']; $LajmeLink = $_POST['LajmeLink']; //$LajmeImg = $_FILES['LajmeImg']['name']; // Me autoName = False; regjistron ne db emrin real te fotografise $LajmeImg = $uploader->source['name']; // Me autoName = true; regjistron ne db emrin random te fotografise i gjeneruar ne base64 $LajmeImg = $_POST['LajmeImg']; $fshij = $_POST['fshij']; // Ticked the 'delete category' box? If so, delete and echo message. if($fshij == 'fshij_LajmeID' && $error == '') { $sql = "DELETE FROM lajme WHERE LajmeID=$LajmeID LIMIT 1"; $query = mysql_query($sql) or die("Fatal error: ".mysql_error()); echo "<h3>U Fshi</h3>"; echo "<div class='success_message'>Lajme <b>$LajmeID</b> u fshi nga sistemi.</div>"; echo "<h2>What to do now?</h2><br />"; echo "Go to the <a href='lajme_edit.php'>edit lajme</a> page.</li>"; } else { // Validate the submitted information if(trim($LajmeID) == '0') { $error = '<div class="error_message">LajmeID - Attention! You cannot edit the main Administrator, use database.</div>'; } else if(trim($LajmeEmri) == '') { $error = '<div class="error_message">LajmeEmri - Attention! You must enter a first name.</div>'; } else if(trim($LajmeLink) == '') { $error = '<div class="error_message">LajmeUrl - Attention! You must enter a last name.</div>'; } // Password been entered? If so, validate and update information. if(trim($KatLajmeID) == '') { $error = '<div class="error_message">Attention! Nuk ke zgjedhur kategorine.</div>'; } else if(trim($LajmeIntro) == '') { $error = '<div class="error_message">Attention! Nuk ke vene Intro.</div>'; } else if(trim($LajmeEmri) == '') { $error = '<div class="error_message">Attention! Nuk ke vene emrin.</div>'; } if($error == '') { $sql = "UPDATE lajme SET KatLajmeID = '$KatLajmeID', LajmeEmri = '$LajmeEmri', LajmeLink = '$LajmeLink', LajmeIntro = '$LajmeIntro', LajmeTxt = '$LajmeTxt', LajmeVideo = '$LajmeVideo', LajmeTag = '$LajmeTag', LajmeImg = '$LajmeImg', LajmeAktiv = '$LajmeAktiv' WHERE LajmeID = '$LajmeID'"; $query = mysql_query($sql) or die("Fatal error: ".mysql_error()); // $sql2 = "SELECT * FROM lajme_kategori WHERE LKatAktiv = PO"; //$sql2 = "SELECT B.LKatEmri, A.LajmeID AS LajmeID, A.LajmeEmri AS LajmeEmri, A.LajmeLink AS LajmeLink, A.LajmeIntro AS LajmeIntro, A.LajmeTxt AS LajmeTxt, A.LajmeTag AS LajmeTag, A.LajmeVideo AS LajmeVideo, A.LajmeAktiv AS LajmeAktiv, B.LKatAktiv = LKatAktiv FROM lajme A LEFT JOIN lajme_kategori B ON A.KatLajmeID = B.LKatID WHERE B.LKatID = KatLajmeID AND LKatAktiv = PO AND LajmeAktiv = PO "; //$sql2 = "SELECT * FROM lajme_Kategori WHERE LKatID = '$KatLajmeID'"; //$result2 = mysql_query($sql2); echo "<h2>U Modifikua</h2>"; echo "<div class='success_message'>Lajmi u modifikua: <b>$LajmeEmri ($LajmeLink)</b> me ID <b>$LajmeID </b>.</div>"; echo "<h2>What to do now?</h2><br />"; echo "Go to the <a href='lajme_edit.php'>edit lajme</a> page.</li>"; } } } // Has a category been selected to edit? if($_GET['lajmeid'] && !isset($_POST['do_edit']) && !isset($_POST['edit_lajme']) || $error != '') { $LajmeID = $_GET['lajmeid']; $sql = "SELECT B.LKatEmri, A.LajmeID AS LajmeID, A.LajmeEmri AS LajmeEmri, A.LajmeLink AS LajmeLink, A.LajmeIntro AS LajmeIntro, A.LajmeTxt AS LajmeTxt, A.LajmeTag AS LajmeTag, A.LajmeImg AS LajmeImg, A.LajmeVideo AS LajmeVideo, A.LajmeAktiv AS LajmeAktiv, A.KatLajmeID AS KatLajmeID FROM lajme A LEFT JOIN lajme_kategori B ON A.KatLajmeID = B.LKatID WHERE B.LKatID = KatLajmeID AND A.LajmeID='$LajmeID'"; $result = mysql_query($sql); $row = mysql_fetch_array($result); $LajmeEmri = $row['LajmeEmri']; $LajmeLink = $row['LajmeLink']; $LajmeIntro = $row['LajmeIntro']; $LajmeTxt = $row['LajmeTxt']; $LajmeVideo = $row['LajmeVideo']; $LajmeTag = $row['LajmeTag']; $LajmeImg = $row['LajmeImg']; $LajmeAktiv = $row['LajmeAktiv']; $KatLajmeID = $row['KatLajmeID']; $LKatEmri = $row['LKatEmri']; echo $error; echo "<h2>Informacionet per lajmin ( ".stripslashes($row['LajmeEmri'])." )</h2>"; ?> <form action="" method="post"> <input type="hidden" name="LajmeID" value="<?=$row['LajmeID'];?>" /> <label style="width: 28%;">Kategoria</label> <select name="KatLajmeID"> <option selected value="<?=stripslashes($row['KatLajmeID']);?>"><?=$LKatEmri ?></option> <?php // Marrja e te dhenave ekzistente ?> <?php $sql2 = "SELECT * FROM lajme_kategori WHERE LKatAktiv = 'PO'"; // Query per te marre kategorite nga database $result2 = mysql_query($sql2); ?> <? while($kategoria = mysql_fetch_array($result2)) { echo '<option value="'.stripslashes($kategoria['LKatID']).'">'.stripslashes($kategoria['LKatEmri']).'</option>'; // Lista e kategorive } ?> </select> <label>Titulli</label> <input type="text" name="LajmeEmri" value="<?=stripslashes($row['LajmeEmri']);?>" /><br /> <label>Linku</label> <input type="text" name="LajmeLink" value="<?=stripslashes($row['LajmeLink']);?>" /><br /> <label>Intro</label><textarea id="LajmeIntro" name="LajmeIntro" /><?=stripslashes($row['LajmeIntro']);?></textarea> <script type="text/javascript"> CKEDITOR.replace( 'LajmeIntro', { filebrowserBrowseUrl : 'includes/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Images', filebrowserFlashBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Flash', filebrowserUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', filebrowserImageUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', filebrowserFlashUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash', }); </script><br /> <label>Lajmi</label> <textarea id="LajmeTxt" name="LajmeTxt" /><?=stripslashes($row['LajmeTxt']);?></textarea> <script type="text/javascript"> CKEDITOR.replace( 'LajmeTxt', { filebrowserBrowseUrl : 'includes/ckfinder/ckfinder.html', filebrowserImageBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Images', filebrowserFlashBrowseUrl : 'includes/ckfinder/ckfinder.html?Type=Flash', filebrowserUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files', filebrowserImageUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images', filebrowserFlashUploadUrl : 'includes/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash' }); </script><br /> <label>Video</label> <textarea id="LajmeVideo" name="LajmeVideo" rows="6" wrap="soft" style="width:700px;" /><?=stripslashes($row['LajmeVideo']);?></textarea><br /> Fotografia: <img src="../imazhet/artikuj/<?=stripslashes($row['LajmeImg']);?>" width="150" align="middle" /><br /> <label>Fotografia</label> <input type="file" size="20" name="LajmeImg" value="<?=stripslashes($row['LajmeImg']);?>" /><br /> <label>Tag</label> <input type="text" name="LajmeTag" value="<?=stripslashes($row['LajmeTag']);?>" /><br /> <label style="width: 50%;">Aktive</label> <input id="LajmeAktiv" name="LajmeAktiv" type="checkbox" <?php if ($LajmeAktiv == "PO") { echo "checked";} ?> value="PO"> <br /><br /> <div class="error_message">Do fshish kete lajm? (Nuk kthehet mbrapsh!) <input type="checkbox" class="checkbox" name="fshij" value="fshij_LajmeID"></div> <input type="submit" value="Ruaje" name="do_edit" /> </form> <? } echo '</div>'; include('poshte.php'); ?> uploaded class <?php /** * Uploader is a file transfer class. it can upload files and images. * It also can resize and crop images. * Works on PHP 5 * @author Alaa Al-Hussein * @link http://www.freelancer-id.com/projects * @version 1.0 * */ class uploader{ /** * Array, The file object as $_FILES['element']. * String, file location. */ public $source; /** * Destination file location as folder. */ public $destDir; /** * Directory for Resized images. */ public $resizeDir; /** * Directory for Cropped images. */ public $cropDir; /** * stores information for uploading file */ private $info = ''; /** * Enabling autoName will generate an auto file name for the uploaded file. */ public $autoName = true; /** * Handles the error when it occurs. */ private $errorMsg = ''; /** * new width for resizing and cropping. */ public $newWidth; /** * new height for resizing and cropping. */ public $newHeight; /** * TOP postion to cropping image. */ public $top = 0; /** * LEFT position for cropping image. */ public $left = 0; /** * JPG quality (0 - 100). used for image resizing or cropping. */ public $quality = 60; public function __construct(){ //nothing } /** * Uploads the file to the server. * @param Array $_FILES[] */ public function upload($source){ if($source != ""){ $this->source = $source; } if(is_array($this->source)){ if($this->fileExists()){ return false; } return $this->copyFile(); } else { return $this->source; } } /** * return the error messages. * @return String messages. */ public function getError(){ return $this->errorMsg; } /** * Get uploading information. */ public function getInfo(){ return $this->info; } /** * Get file ex. */ function getEx(){ return strtolower(substr($this->source['name'], strrpos($this->source['name'], '.') + 1)); } /** * Get random name. */ function randName(){ return substr(base64_encode(uniqid()),0,10); } /** * Copy the uploaded file to destination. */ private function copyFile(){ if(!$this->isWritable()){ $this->errorMsg .= '<div>Error, the directory: ('.$this->destDir.') is not writable. Please fix the permission to be able to upload.</div>'; return false; } $this->source['name'] = ($this->autoName) ? $this->randName().'.'.$this->getEx(): $this->source['name']; if(copy($this->source['tmp_name'],$this->destDir . $this->source['name'])){ // Done. $this->info .= '<div>file was uploaded successfully.</div>'; } else { $this->errorMsg .= '<div>Error, the file was not uploaded correctly because of an internal error. Please try again, if you see this message again, please contact web admin.</div>'; } } /** * Checks if the file was uploaded. * @return boolean */ private function uploaded(){ if($this->source['tmp_name']=="" || $this->source['error'] !=0){ $this->errorMsg .= '<div>Error, file was not uploaded to the server. Please try again.</div>'; return false; } else return true; } /** * Prepares the directory. */ private function preDir(){ if($this->destDir!="" && substr($this->destDir, -1,1) != "/"){ $this->destDir = $this->destDir . '/'; } if($this->resizeDir!="" && substr($this->resizeDir, -1,1) != "/"){ $this->destDir = $this->resizeDir . '/'; } if($this->cropDir!="" && substr($this->cropDir, -1,1) != "/"){ $this->destDir = $this->cropDir . '/'; } } /** * Check if the folder is writable or not. * @return boolean */ private function isWritable(){ $err = false; if(!is_writeable($this->destDir) && $this->destDir!=""){ $this->errorMsg .= '<div>Error, the directory ('.$this->destDir.') is not writeable. File could not be uploaded.</div>'; $err = true; } if(!is_writeable($this->resizeDir) && $this->resizeDir!=""){ $this->errorMsg .= '<div>Error, the directory ('.$this->resizeDir.') is not writeable. File could not be resized.</div>'; $err = true; } if(!is_writeable($this->cropDir) && $this->cropDir!=""){ $this->errorMsg .= '<div>Error, the directory ('.$this->cropDir.') is not writeable. File could not be cropped.</div>'; $err = true; } if($err == true){ return false; } else { return true; } } /** * Checks if the file exists on the server * @return boolean */ private function fileExists(){ $this->preDir(); if(file_exists($this->destDir.$this->source)){ $this->errorMsg .= '<div>Upload error because file already exists.</div>'; return true; } else { return false; } } /** /586742130./8532 Crops image. * @return String fileName or False on error */ public function crop($file='',$width='',$height='',$top='',$left=''){ if($file!=""){ $this->source = $file;} if ($width != '') $this->newWidth = $width; if ($height != '') $this->newHeight = $height; if ($top != '') $this->top = $top; if ($left != '') $this->left = $left; return $this->_resize_crop(true); } /** * Resizes an image. * @return String fileName or False on error */ public function resize($file='',$width='',$height=''){ if($file!=""){ $this->source = $file; } if($width != '') $this->newWidth = $width; if($height != '') $this->newHeight = $height; return $this->_resize_crop(false); } /** * Get the Temp file location for the file. * If the Source was a file location, it returns the same file location. * @return String Temp File Location */ private function getTemp(){ if(is_array($this->source)){ return $this->source['tmp_name']; } else { return $this->source; } } /** * Get the File location. * If the source was a file location, it returns the same file location. * @return String File Location */ private function getFile(){ if(is_array($this->source)){ return $this->source['name']; } else { return $this->source; } } /** * Resize or crop- the image. * @param boolean $crop * @return String fileName False on error */ private function _resize_crop ($crop) { $ext = explode(".",$this->getFile()); $ext = strtolower(end($ext)); list($width, $height) = getimagesize($this->getTemp()); if(!$crop){ $ratio = $width/$height; if ($this->newWidth/$this->newHeight > $ratio) { $this->newWidth = $this->newHeight*$ratio; } else { $this->newHeight = $this->newWidth/$ratio; } } $normal = imagecreatetruecolor($this->newWidth, $this->newHeight); if($ext == "jpg") { $src = imagecreatefromjpeg($this->getTemp()); } else if($ext == "gif") { $src = imagecreatefromgif ($this->getTemp()); } else if($ext == "png") { $src = imagecreatefrompng ($this->getTemp()); } if($crop){ $pre = 'part_'; if(imagecopy($normal, $src, 0, 0, $this->top, $this->left, $this->newWidth, $this->newHeight)){ $this->info .= '<div>image was cropped and saved.</div>'; } $dir = $this->cropDir; } else { $pre = 'thumb_'; if(imagecopyresampled($normal, $src, 0, 0, 0, 0, $this->newWidth, $this->newHeight, $width, $height)){ $this->info .= '<div>image was resized and saved.</div>'; } $dir = $this->resizeDir; } if($ext == "jpg" || $ext == "jpeg") { imagejpeg($normal, $dir . $pre . $this->getFile(), $this->quality); } else if($ext == "gif") { imagegif ($normal, $dir . $pre . $this->getFile()); } else if($ext == "png") { imagepng ($normal, $dir . $pre . $this->getFile(),0); } imagedestroy($src); return $src; } } ?> Can someone help me, please? Thank you in advance! Similar TutorialsHi i have the script to upload files i set the type of file and extension allowed all the files type and extension i can upload except mp4 is ther anything extra i need to do isnt file type (video/mp4) extension (mp4) but still not working. Code: [Select] <?php mysql_connect("localhost", "root", "") or die(mysql_error()) ; mysql_select_db("database_name") or die(mysql_error()) ; // my file the name of the input area on the form type is the extension of the file //echo $_FILES["myfile"]["type"]; //myfile is the name of the input area on the form $name = $_FILES["image"]["name"]; // name of the file $type = $_FILES["image"]["type"]; //type of the file $size = $_FILES["image"]["size"]; //the size of the file $temp = $_FILES["image"]["tmp_name"];//temporary file location when click upload it temporary stores on the computer and gives it a temporary name $error =array(); // this an empty array where you can then call on all of the error messages $allowed_exts = array('jpg', 'jpeg', 'png', 'gif','avi','mp4'); // array with the following extension name values $image_type = array('image/jpg', 'image/jpeg', 'image/png', 'image/gif', 'video/mp4'); // array with the following image type values $location = 'images/'; //location of the file or directory where the file will be stored $appendic_name = "news".$name;//this append the word [news] before the name so the image would be news[nameofimage].gif // substr counts the number of carachters and then you the specify how how many you letters you want to cut off from the beginning of the word example drivers.jpg it would cut off dri, and would display vers.jpg //echo $extension = substr($name, 3); //using both substr and strpos, strpos it will delete anything before the dot in this case it finds the dot on the $name file deletes and + 1 says read after the last letter you delete because you want to display the letters after the dot. if remove the +1 it will display .gif which what we want is just gif $extension = strtolower(substr($name, strpos ($name, '.') +1));//strlower turn the extension non capital in case extension is capital example JPG will strtolower will make jpg // another way of doing is with explode // $image_ext strtolower(end(explode('.',$name))); will explode from where you want in this case from the dot adn end will display from the end after the explode $title = $_POST["title"]; $subtitle = $_POST["subtitle"]; if (isset($image)) // if you choose a file name do the if bellow { // if extension is not equal to any of the variables in the array $allowed_exts error appears if(in_array($extension, $allowed_exts) === false ) { $error[] = 'Extension not allowed! gif, jpg, jpeg, png only<br />'; // if no errror read next if line } // if file type is not equal to any of the variables in array $image_type error appears if(in_array($type, $image_type) === false) { $error[] = 'Type of file not allowed! only images allowed<br />'; } // check if folder exist in the server if(!file_exists ($location)) { $error[] = 'No directory ' . $location. ' on the server Please create a folder ' .$location; } } // if no error found do the move upload function if (empty($error)){ if (move_uploaded_file($temp, $location .$appendic_name)) { if (move_uploaded_file($temp1, $location .$name1)) { // insert data into database first are the field name teh values are the variables you want to insert into those fields appendic is the new name of the image mysql_query("INSERT INTO tablename (title, subtitle, image) VALUES ('$title', '$subtitle', '$appendic_name')") ; echo $type; echo "<br />"; echo $type1; } } else { foreach ($error as $error) { echo $error; } } } //echo $type; ?> if ($btn){ if((!empty($filename)) && ($error == 0)) { if (($filetype == "image/jpeg" || $filetype == "image/jpg" || $filetype == "image/gif" || $filetype == "image/png") && ($filesize < 4508876)) { $moving_flag = true; $moving_msg = "Your image has been uploaded!"; } else { $upl_error_msg = "Error: Only jpg/gif/png images under 4Mb are accepted for upload"; $upl_error_flag = true; } } else { $upl_error_msg = "Error: No file uploaded"; $upl_error_flag = true; } } Why the above code wont work on IE and wont show me "Your image has been uploaded!" message when i have a valid type and size? it works on chrome and FF How can i edit just one image at on time with a multiple image upload form? I have the images being stored in a folder and the path being stored in MySQL. I also have the files being uploaded with a unique id. My issue is that I want to be able to pass the values of what is already in $name2 $name3 $name4 if I only want to edit $name1. I don't want to have to manually update the 4 images. Here is the PHP: Code: [Select] <?php require_once('storescripts/connect.php'); mysql_select_db($database_phpimage,$phpimage); $uploadDir = 'upload/'; if(isset($_POST['upload'])) { foreach ($_FILES as $file) { $fileName = $file['name']; $tmpName = $file['tmp_name']; $fileSize = $file['size']; $fileType = $file['type']; if ($fileName != ""){ $filePath = $uploadDir; $fileName = str_replace(" ", "_", $fileName); //Split the name into the base name and extension $pathInfo = pathinfo($fileName); $fileName_base = $pathInfo['fileName']; $fileName_ext = $pathInfo['extension']; //now we re-assemble the file name, sticking the output of uniqid into it //and keep doing this in a loop until we generate a name that //does not already exist (most likely we will get that first try) do { $fileName = $fileName_base . uniqid() . '.' . $fileName_ext; } while (file_exists($filePath.$fileName)); $file_names [] = $fileName; $result = move_uploaded_file($tmpName, $filePath.$fileName); } if(!get_magic_quotes_gpc()) { $fileName = addslashes($fileName); $filePath = addslashes($filePath); } $fileinsert[] = $filePath; } } $mid = mysql_real_escape_string(trim($_POST['mid'])); $cat = mysql_real_escape_string(trim($_POST['cat'])); $item = mysql_real_escape_string(trim($_POST['item'])); $price = mysql_real_escape_string(trim($_POST['price'])); $about = mysql_real_escape_string(trim($_POST['about'])); $fields = array(); $values = array(); $updateVals = array(); for($i = 0; $i < 4; $i++) { $values[$i] = isset($file_names[$i]) ? mysql_real_escape_string($file_names[$i]) : ''; if($values[$i] != '') { $updateVals[] = 'name' . ($i + 1) . " = '{$values[$i]}'"; } } $updateNames = ''; if(count($updateVals)) { $updateNames = ", " . implode(', ', $updateVals); } $update = "INSERT INTO image (mid, cid, item, price, about, name1, name2, name3, name4) VALUES ('$mid', '$cat', '$item', '$price', '$about', '$values[0]', '$values[1]', '$values[2]', '$values[3]') ON DUPLICATE KEY UPDATE cid = '$cat', item = '$item', price = '$price', about = '$about' $updateNames"; $result = mysql_query($update) or die (mysql_error()); Hello I am having problems uploading an image through a HTML form. I want the image to be uploaded to the server and the image name to be written to the mysql database. Below is the code I am using: Code: [Select] <?php if (isset($_POST['add'])){ echo "<br /> add value is true"; $name = $_POST['name']; $description = $_POST['description']; $price = $_POST['price']; $category_id = $_POST['category_name']; $image = $_FILES['image']['name']; //file path of the image upload $filepath = "../images/"; //mew name for the image upload $newimagename = $name; //new width for the image $newwidth = 100; //new height for the image $newheight = 100; include('../includes/image-upload.php'); mysql_query("INSERT INTO item (item_name, item_description, item_price, item_image) VALUES ('$name','$description','$price','$image')"); ?> Here is the image-upload.php file code: Code: [Select] <?php //assigns the file to the image $image =$_FILES["image"]["name"]; $uploadedfile =$_FILES["image"]["tmp_name"]; if ($image) { //retrieves the extension type from image upload $extension = getextension($image); //converts extension to lowercase $extension = strtolower($extension); //create image from uploaded file type if($extension=="jpg" || $extension=="jpeg") { $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefromjpeg($uploadedfile); }else if($extension=="png") { $uploadedfile = $_FILES['image']['tmp_name']; $src = imagecreatefrompng($uploadedfile); }else{ $src = imagecreatefromgif($uploadedfile); } //creates a list of the width and height of the image list($width,$height)=getimagesize($uploadedfile); //adds color to the image $tmp = imagecreatetruecolor($newwidth,$newheight); //create image imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); //set file name $filename = $filepath.$newimagename.".".$extension; $imagename = $newimagename.".".$extension; //uploads new file with name to the chosen directory imagejpeg($tmp,$filename,100); //empty variables imagedestroy($src); imagedestroy($tmp); } ?> Any help would be appreciated, fairly new to all this! Thanks!!! hello friends, while clicking the form all the information goes to database, I have one image upload field, when cliking the submit button, i would like 'image name' to go in database and file to go in /upload folder, i have tried this for hours and gave up, if anyone help me in this, i would be very greatful I have a working image upload script that uploads, renames the file and adds filename to the database. is it possible to include some sort of image resize code? if so can anyone point me in the right direction or better still show some example code and explain how it works etc. below is my working code: Code: [Select] <?php $rand = mt_rand(1,9999999); $member_id = $_SESSION['SESS_MEMBER_ID']; $caption = $_POST["caption"]; if(isset($_FILES['uploaded']['name'])) { $allowed_filetypes = array('.jpg','.gif','.bmp','.png','.jpeg'); $max_filesize = 524288; // Maximum filesize in BYTES (currently 0.5MB) $fileName = basename($_FILES['uploaded']['name']); $errors = array(); $target = "gallery/"; $fileBaseName = substr($fileName, 0, strripos($fileName, '.')); // Get the extension from the filename. $ext = substr($fileName, strpos($fileName,'.'), strlen($fileName)-1); //$newFileName = md5($fileBaseName) . $ext; $newFileName = $target . $rand . "_" . $member_id.$ext; // Check if filename already exists if(file_exists("gallery/" . $newFileName)) { $errors[] = "The file you attempted to upload already exists, please try again."; } // Check if the filetype is allowed. if(!in_array($ext,$allowed_filetypes)) { $errors[] = "The file you attempted to upload is not allowed."; } // Now check the filesize. if(!filesize($_FILES['uploaded']['tmp_name']) > $max_filesize) { $errors[] = "The file you attempted to upload is too large."; } // Check if we can upload to the specified path. if(!is_writable($target)) { $errors[] = "You cannot upload to the specified directory, please CHMOD it to 777."; } //Here we check that no validation errors have occured. if(count($errors)==0) { //Try to upload it. if(!move_uploaded_file($_FILES['uploaded']['tmp_name'], $newFileName)) { $errors[] = "Sorry, there was a problem uploading your file."; } } //Lets INSERT database information here if(count($errors)==0) { $result = mysql_query("INSERT INTO `gallery` (`image`, `memberid`, `caption`) VALUES ('$newFileName', '$member_id', '$caption')") or die (mysql_error()); } //If no errors show confirmation message if(count($errors)==0) { echo "<div class='notification success png_bg'> <a href='#' class='close'><img src='img/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Image has been uploaded.<br>\n </div> </div>"; //echo "The file {$fileName} has been uploaded"; echo "<br>\n"; echo "<a href='gallery.php'>Go Back</a>\n"; } else { //show error message echo "<div class='notification attention png_bg'> <a href='#' class='close'><img src='img/cross_grey_small.png' title='Close this notification' alt='close' /></a> <div> Sorry your file was not uploaded due to the following errors:<br>\n </div> </div>"; //echo "Sorry your file was not uploaded due to the following errors:<br>\n"; echo "<ul>\n"; foreach($errors as $error) { echo "<li>{$error}</li>\n"; } echo "</ul>\n"; echo "<br>\n"; echo "<a href='gallery.php'>Go Back</a>\n"; } } else { //Show the form echo "Use the following form below to add a new image to your gallery;<br /><br />\n"; echo "<form enctype='multipart/form-data' action='' method='POST'>\n"; echo "Please choose a file:<br /><input class='text' name='uploaded' type='file' /><br />\n"; echo "Image Caption:<br /><input class='text' name='caption' type='text' value='' /><br /><br />\n"; echo "<input class='Button' type='submit' value='Upload' />\n"; echo "</form>\n"; } ?> Many thanks to phpfreaks again. I need code for upload images for php as well as to edit that image
Hi, Im rather new to php and really unable to get the above to work. Everything works apart from the image being resized. File is uploaded, and the image name is printed into the SQL database. But i cant for the life of me get the image to go to 300x200? If you could help me i would be very grateful My code for the form processing page is attached. Ive put a few line breaks into the code as to where i think is the issue. I just cant seem to resize the image. Does the image resize need to come before the part it writes the image to the server or can this be done afterwards? Please help. P.S - Thanks in advance I am beginner in PHP and i tried to find a tutorial on this subject across the web, but all i found was one tutorial how to store image like blob and a lot of scripts (which at the moment I don't understand). I want to create form to upload image to specific folder and then to insert image name and path into DB. If you know some tutorial on this subject please let me know, or if someone can help to write it it would be great . It will add the 'FILES' folder if it isn't there, but just refreshes the page, displaying no errors, without adding anything to the folder??? As you can probably see I have three file slots for users, I want to fill the next available slot up, and if no slots, display error 2 ($e=2; - Delete a file to make space) Code: [Select] //^^GET VARIABLES SUCH AS USERNAME ETC. if(isset($_POST['uploadfile'])){ if(is_dir("files/$username/FILES/")){}else{mkdir("files/$username/FILES/");} if (is_uploaded_file($_FILES['file']['tmp_name'])) { $name = $_FILES['file']['name']; if ($file != "application/pdf" || substr(strrchr($file, '.'), 1) != "pdf" || substr(strrchr($file, '.'), 1) != "jpg" || $file != "image/jpeg" || $file != "image/pjpeg") { $errors[] = 'File must be in PDF or JPEG format'; } else if($_FILES['file']['size'] > 256000){$errors[] = 'File must be under 250KB';} else { $name1 = substr($name, 0, strrpos($name, '.')); $ext = strtolower(substr(strrchr($name, '.'), 1)); $name = $name1.'.'.$ext; $res = mysql_query("SELECT username,file1,file2,file3 FROM `files` WHERE `username`='$username'"); $row = mysql_fetch_array($res); $f1 = $row['file1']; $f2 = $row['file2']; $f3 = $row['file3']; if($f1==''){ $result = move_uploaded_file($_FILES['file']['tmp_name'], "files/$username/FILES/$name"); if ($result == 1){ $time = time(); $t=1; mysql_query("UPDATE files SET file1='$name', file1_val='0', file1_added='$time' WHERE username='$username'"); }else $e=1; }else if(empty($f2)){ $result = move_uploaded_file($_FILES['file']['tmp_name'], "files/$username/FILES/$name"); if ($result == 1){ $time = time(); $t=1; mysql_query("UPDATE files SET file2='$name', file2_val='0', file2_added='$time' WHERE username='$username'"); }else $e=1; }else if(empty($f3)){ $result = move_uploaded_file($_FILES['file']['tmp_name'], "files/$username/FILES/$name"); if ($result == 1){ $time = time(); $t=1; mysql_query("UPDATE files SET file3='$name', file3_val='0', file3_added='$time' WHERE username='$username'"); }else $e=1; }else{$e=2;} } } } Hello everyone.i'm beginner in programming.How to make page that user can upload their own image.. my database table:product product_id (PK) product_price product_name product_picture anyone can help me..thank for advance:) does anyone know a good open source image upload with info upload basically upload a image to a dir and submitt the info like $date $title $who to a DB Thanks in advance I have absolutely no idea how to allow users to upload their own avatars and then have the file save as their user ID (uID), and if the uID already exists, then have it overwrite it. I'm having some trouble with an image upload form. I have a few instances of this code that works in other areas of my site so I'm pretty sure there is just something small that I'm missing: The Form: <? include("../include/session.php"); ?> <html> <head> <title>Template Configuration</title> <link rel="stylesheet" type="text/css" href="../css/backend.css"> </head> <body> <? if($session->logged_in){ $data = mysql_query("SELECT * FROM template WHERE id = '1'") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { echo " <h1 style='text-align:center;'>Template Configuration</h1> <div id='textedit'> <form method='post' action='templateprocess.php' enctype='multipart/form-data'> <table> <tr><td><h2>Header Image</h2></td></tr> <tr><td colspan='2' style='text-align:center'><img src='../upload/template/".$info['headerimg'] ."'><br /><br /></tr></td> <tr> <td>Image Upload:</td> <td> <input type='file' name='headerimg'> </td> </tr> </table <input type='hidden' name='id' value='1'> <input TYPE='submit' name='upload' title='Add data to the Database' value='Submit'/> </form> <a href='../main.php'><img src='../images/backButton.jpg'></a> </div> "; } } else{ echo "[<a href='../main.php'>Please Login</a>] "; } ?> </body> </html> The Processor: <? include("../include/session.php"); ?> <html> <head> <title>Template Configuration</title> <link rel="stylesheet" type="text/css" href="../css/backend.css"> </head> <body> <div id='process'> <? if($session->logged_in){ $target = "/path/to/folder/upload/template/"; if ($headerimg != ''){ $headerimg = ($_FILES['headerimg']['name']); foreach($_FILES as $file) { move_uploaded_file($file['tmp_name'], $target . $file['name']); } mysql_query("UPDATE template SET headerimg ='$headerimg' WHERE id ='1'"); } ?> <p>Update Successful... <a href="../main.php">click here</a> to return to the administration area.</p> <?php } else{ echo "[<a href='../main.php'>Please Login</a>] "; } ?> </div> </body> </html> My database has a table named 'template' with two fields of 'id' and 'headerimg'. I have inserted into the table (id) '1' and (headerimg) 'header-image.png' and is reading this as a preview above. I can't, however, get the 'headerimg' field to update and the image never uploads into my template folder. Hey everyone - I was wondering if there was a good tutorial or documentation on how to upload an image, have it resize and then call it back from, say, a mysql query? Trying to make something so that users can add an image to a small news post. I tried search the tutorial but I didn't find anything. Any past samples or suggestions are greatly appreciated. Thanks! Hi Guys! I already have a database with a table that stores information about different franchises for the company like franchise name, address, tel, email etc etc. This works beautiful so I can CRUD this data. However, now to be able to add the facility for each franchise to be able to upload their own image of the franchise itself and still be able to CRUD the data. I have looked on the internet and found many scripts using BLOB etc but I can get it to link in with my existing table. I'll show you the edit form that I have so far. (Pleas not Ter = territory, ie the territory that franchise covers. <?php include('config.php'); if (isset($_GET['Ter']) ) { $ter = (int) $_GET['Ter']; if (isset($_POST['submitted'])) { foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } $sql= "UPDATE `ter` SET `Ter` = '{$_POST['Ter']}' , `BranchName` = '{$_POST['BranchName']}' , `BranchAddress` = '{$_POST['BranchAddress']}' , `BranchTel` = '{$_POST['BranchTel']}' , `BranchEmail` = '{$_POST['BranchEmail']}' , `BranchLink` = '{$_POST['BranchLink']}' , `Theme` = '{$_POST['Theme']}' , `LocalInfo` = '{$_POST['LocalInfo']}' , `BranchInfo` = '{$_POST['BranchInfo']}' WHERE `Ter` = '$ter' "; mysql_query($sql) or die(mysql_error()); echo (mysql_affected_rows()) ? "Edited Branch.<br />" : "Nothing changed. <br />"; } $row = mysql_fetch_array ( mysql_query("SELECT * FROM `ter` WHERE `Ter` = '$ter' ")); ?> <form action='' method='POST'> <p><b>Territory:</b><br /><input name='Ter' type='text' value='<?= stripslashes($row['Ter']) ?>' size="3" readonly="readonly" /> <p><b>Branch Name:</b><br /><input name='BranchName' type='text' value='<?= stripslashes($row['BranchName']) ?>' size="50" /> <p><b>Address:</b><br /> <textarea name='BranchAddress' cols="40" rows="5"><?= stripslashes($row['BranchAddress']) ?></textarea> <p><b>Telephone:</b><br /><input name='BranchTel' type='text' value='<?= stripslashes($row['BranchTel']) ?>' size="15" /> <p><b>Email:</b><br /><input name='BranchEmail' type='text' value='<?= stripslashes($row['BranchEmail']) ?>' size="50" /> <p><b>Link:</b><br /><input name='BranchLink' type='text' value='<?= stripslashes($row['BranchLink']) ?>' size="50" /> <hr /> <p><b>Your Single Webpage Options</b> <p><b>Theme:</b><br /> <input name='Theme' type='text' value='<?= stripslashes($row['Theme']) ?>' size="1" /> <p><b>Local Information:</b><br /> <textarea name='LocalInfo' cols="85" rows="8" id="LocalInfo"><?= stripslashes($row['LocalInfo']) ?> </textarea> <p><b>Franchise Information:</b><br /> <textarea name='BranchInfo' cols="85" rows="8" id="BranchInfo"><?= stripslashes($row['BranchInfo']) ?> </textarea> <p><b>Photo:</b><br /> <label> <input type="file" name="photo" id="photo" /> </label> (Franchise Photo) <p><b>Downloads:</b><br /> <label> <input type="file" name="download1" id="download1" /> </label> (S/O Mandate) <p> <label> <input type="file" name="download2" id="download2" /> </label> (Other Download) <p> <label> <input type="file" name="download3" id="download3" /> </label> (Other Download) <p> <input type='submit' value='Save' /> <input type='hidden' value='1' name='submitted' /> </form> <? } ?> It is the 'photo' file above that I want to be able to upload the image with. Is this the right way to do it? Ignore the download1,2,3 bit. Cheers, S Hi everybody, I have similar problem like member vikaspa in this thread: http://www.phpfreaks.com/forums/index.php?topic=279531.msg1323820#msg1323820 Have great site, but this image rewriting makes me crazy...today someone upload in some thread 1.jpg for example...after 3 days someone uploads diferent image and also called it 1.jpg, and overwrites this earlier one. Nonsense. Please help me with my code, what to add where, to prevent rewriting and instead that, to rename upload internally (without notifying the user)...for example 1_1.jpg. Here is my code: Code: [Select] if ($fdata['forum_attach'] && checkgroup($fdata['forum_attach'])) { $attach = $_FILES['attach']; if ($attach['name'] != "" && !empty($attach['name']) && is_uploaded_file($attach['tmp_name'])) { $attachname = stripfilename(substr($attach['name'], 0, strrpos($attach['name'], "."))); $attachext = strtolower(strrchr($attach['name'],".")); if (preg_match("/^[-0-9A-Z_\[\]]+$/i", $attachname) && $attach['size'] <= $settings['attachmax']) { $attachtypes = explode(",", $settings['attachtypes']); if (in_array($attachext, $attachtypes)) { $attachname .= $attachext; move_uploaded_file($attach['tmp_name'], FORUM."attachments/".$attachname); chmod(FORUM."attachments/".$attachname,0644); if (in_array($attachext, $imagetypes) && (!@getimagesize(FORUM."attachments/".$attachname) || !@verify_image(FORUM."attachments/".$attachname))) { unlink(FORUM."attachments/".$attachname); $error = 1; } if (!$error) { $result = dbquery("INSERT INTO ".DB_FORUM_ATTACHMENTS." (thread_id, post_id, attach_name, attach_ext, attach_size) VALUES ('".$thread_id."', '".$post_id."', '$attachname', '$attachext', '".$attach['size']."')"); } } else { @unlink($attach['tmp_name']); $error = 1; } } else { @unlink($attach['tmp_name']); $error = 2; } Member Little guy wrote: $tmp_name = $_FILES["pictures"]["tmp_name"]; $tmp_new_name = $_FILES["pictures"]["name"]; $path_parts = pathinfo($tmp_new_name); $new_name = $path_parts['filename'] . time() . $path_parts['extension']; $uploads_dir = '/uploads'; move_uploaded_file($tmp_name, "$uploads_dir/$new_name"); But I'm completely noob for coding and don't know where to put that in my forum code. Please help. Thanx in advance, sorry for longer thread, and for my english. Regards. I have a PHP script that modifies images that are stored in a local folder related to $startingFolder.
Essentially, I can use To manage the variables and direct the source and destination of the scripts actions from this starting point. I'm trying to extend my capabilities so that I can use the script while uploading images. Rather than UPLOAD several images to $startingFolder and then run the script, I thought it would be more efficient to handle this in one script. However, I am having trouble making the CONNECTION so that this can be accomplished. What is the proper way to 'grab' the files during upload? How can I access the files during the process?
I have a working HTML
And have tried
|