PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Closed Thread
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 18th, 2012, 08:44 AM
IMaVBNoob's Avatar
IMaVBNoob IMaVBNoob is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 122 IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level)IMaVBNoob User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 13 h 57 m 38 sec
Reputation Power: 8
Send a message via MSN to IMaVBNoob
Php script not uploading or posting any errors

Hi everyone i am developing and testing site with xampp everything seams to be going fine until i starting having issues with this upload script. For some reason the $_POST is not being set when the submit button is being pressed. also no errors are being displayed. I put a few echo points to see how far along the script was getting and i guess it wasnt so far. im sure im over looking something small and it will be a palm to face moment but i have to get this work asap.. Thx

PHP CODE:

Code:
<?php include_once("scripts/global.php");
//session_start;
$displaymessage = 'Upload a new image';
if(isset($_POST['submit'])){
	echo ("Post is set");
	$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "image/jpg"))
&& ($_FILES["file"]["size"] < 200000)
&& in_array($extension, $allowedExts))
  {
	  echo ("File allowed");
  if ($_FILES["file"]["error"] > 0)
    {
    echo "Error >> " . $_FILES["file"]["error"] . "<br />";
    }
  else
    {
    if (file_exists("user/".$session_id."/")){
    if (file_exists("user/".$session_id."/" . $_FILES["file"]["name"]))
      {
      $displaymessage = ">> ".$_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "user/".$session_id."/" . $_FILES["file"]["name"]);
      $displaymessage = ">> Your file has been uploaded:". $_FILES["file"]["name"];
      }
	  }else{
		  mkdir("user/".$session_id."/");
		  
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "user/".$session_id."/" . $_FILES["file"]["name"]);
      $displaymessage = ">> Your file has been uploaded:". $_FILES["file"]["name"];
      }
		
    }
  }
else
  {
  $displaymessage = ">> Invalid file";
  }
}
?>


Here is the form snipit

Code:
<span class='SoicalHeader_center'><?php print ("".$displaymessage.""); ?></span>
           <form action="manage_my_photos.php" method="POST" enctype="multipart/form-data"> 
          <input type="file" name="image" id="image"/></br>
          <input name="upload" type="submit" value="Upload" />
           </form>

Last edited by IMaVBNoob : November 18th, 2012 at 09:01 AM.

Reply With Quote
Closed Thread

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Php script not uploading or posting any errors

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap