thescientist Posted October 8, 2013 Share Posted October 8, 2013 You are not telling me the solution. I know that I need to redirect only if the submit button is pressed, but I don't know how to do it. you can always search for it. top result gives a pretty straightforward answer https://www.google.com/search?q=tell+if+form+was+submitted&oq=tell+if+form+was+submitted&aqs=chrome..69i57j69i60l5.6173j0j7&sourceid=chrome&espvd=210&es_sm=119&ie=UTF-8#es_sm=119&q=tell+if+form+was+submitted+php&safe=off while I understand it can be frustrating, we're hear to teach first. We're more inclined to give assistance after you have attempted the task first. We don't generally just give out the answer, and instead initially defer to guidance and suggestion. 1 Link to comment Share on other sites More sharing options...
LucaCrippa Posted October 8, 2013 Author Share Posted October 8, 2013 you can always search for it. top result gives a pretty straightforward answer https://www.google.com/search?q=tell+if+form+was+submitted&oq=tell+if+form+was+submitted&aqs=chrome..69i57j69i60l5.6173j0j7&sourceid=chrome&espvd=210&es_sm=119&ie=UTF-8#es_sm=119&q=tell+if+form+was+submitted+php&safe=off while I understand it can be frustrating, we're hear to teach first. We're more inclined to give assistance after you have attempted the task first. We don't generally just give out the answer, and instead initially defer to guidance and suggestion. Sure, but if I ask for info directly in a forum I would like to have an answer, just because there are many guides on the web... if one cannot solve its problems with guides, he asks in forums... Anyway, I'm trying Ingolme solution Link to comment Share on other sites More sharing options...
divinedesigns1 Posted October 18, 2013 Share Posted October 18, 2013 Sure, but if I ask for info directly in a forum I would like to have an answer, just because there are many guides on the web... if one cannot solve its problems with guides, he asks in forums... Anyway, I'm trying Ingolme solution what is it do you not understand really? Do you know how to send a form information using mail()? If not I can give you a quick tutorial on how to do so Link to comment Share on other sites More sharing options...
LucaCrippa Posted October 23, 2013 Author Share Posted October 23, 2013 Hi, please could you tell me where I'm doing wrong? Page php 1: list of directories where to upload images (galleryedit.php) <?php $path = '../public/gallery';$dirs = scandir($path);foreach ($dirs as $valore) { if($valore === '.' || $valore === '..') { continue; } echo "<a href=uploadimage.php?cartella=$valore> <img src="images/icons/edit.png" title="Carica" width="15" height="15"> </a> $valore </br>";}?> Page php 2: form to upload image, which takes the name of the folder where I want to upload (uploadimage.php) <?php$path = '../public/gallery';$cartella = $path .'/'. $_GET['cartella'];echo "<form action="upload.php?updir=$cartella" method="post" enctype="multipart/form-data"> <input name="image" type="file" size="40" /> <br /><br /> <input name="submit" type="submit" value="Carica immagine" /></form>";?> Page php 3: the uploading facility, which takes the name of the folder (upload.php) <?php $path = '../public/gallery';$dir = $_GET['updir'];if(!isset($_SERVER['DOCUMENT_ROOT'])){ if(isset($_SERVER['SCRIPT_FILENAME'])){ $_SERVER['DOCUMENT_ROOT'] = str_replace( '', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); };}; if(!isset($_SERVER['DOCUMENT_ROOT'])){ if(isset($_SERVER['PATH_TRANSLATED'])){ $_SERVER['DOCUMENT_ROOT'] = str_replace( '', '/', substr(str_replace('', '', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); };};$PercorsoDominio = $_SERVER['DOCUMENT_ROOT'];$public = "/$path/$dir/";if(is_dir($PercorsoDominio.$public)){ continue; }else{ exit; }if ((($_FILES["file"]["type"] == "image/gif") ||($_FILES["file"]["type"] == "image/jpeg") ||($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] < 20000000)) ) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists($PercorsoDominio. $public . $_FILES["file"]["name"])) { continue; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $PercorsoDominio. $public . $_FILES["file"]["name"]); include("uploadsuccess.php"); } } }else { include("uploaderror.php"); }}?> Thank you!! Link to comment Share on other sites More sharing options...
justsomeguy Posted October 23, 2013 Share Posted October 23, 2013 Print out the value of $PercorsoDominio.$public in the last file, it's not set to what you think it is. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now