Jump to content
LucaCrippa

edit and erase blog post php

Recommended Posts

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.

  • Like 1

Share this post


Link to post
Share on other sites

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 ;)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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!!

Share this post


Link to post
Share on other sites

Print out the value of $PercorsoDominio.$public in the last file, it's not set to what you think it is.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...