Jump to content

cshong00

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cshong00's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks pocobueno, I've modified my code so it's as below: <?php $path = "att/"; chmod($path, 0777); if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists($path . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $path . $_FILES["file"]["name"]); echo "Done"; } } ?> I'm assuming this will give me everyone read, write and execute permissions on the "att/" folder. When I try to upload to this however, I get a new chmod() error message and the same two messages I was getting before: Warning: chmod(): Operation not permitted in /home/kccdenve/public_html/EM/new/upload2.php on line 3 Warning: move_uploaded_file(att/test.txt): failed to open stream: Permission denied in /home/kccdenve/public_html/EM/new/upload2.php on line 14 Warning: move_uploaded_file(): Unable to move '/var/tmp/php1zwVbP' to 'att/test.txt' in /home/kccdenve/public_html/EM/new/upload2.php on line 14 Any ideas? Chris
  2. Hi all, I've run into a problem that a lot of other people seem have run into but I haven't been able to find the resolution so I'm hoping someone can help. I'm getting the following two error messages when I try to use the move_uploaded_file() method to upload hongkim.jpg: Warning: move_uploaded_file(hongkim.jpg): failed to open stream: Permission denied in /home/kccdenve/public_html/EM/new/upload2.php on line 10 Warning: move_uploaded_file(): Unable to move '/var/tmp/phpCvzSP9' to 'hongkim.jpg' in /home/kccdenve/public_html/EM/new/upload2.php on line 10 The code on the upload page is as below: <?php if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { if (file_exists($_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]); echo "Done"; } } ?> I've read several different solutions for this on the web (modifying the chmod of the folder, modifying the directory permission to 777, modifying my php.ini) but I don't know how and/or where these configurations and permissions are set. Is this permissions issue I have to take up with my hosting provider or can i take care of this myself? Some help on this would be much appreciated! Chris
  3. n00b mistake... Thanks bubblegum, it worked like a charm.
  4. Hi, I'm wondering if I could get some help on an issue I'm having with a site that I'm on. I have two pages. The first page has an HTML form (nothing fancy, just some input boxes and a submit button). On the second page I have this code: <?php $contentid = $_POST["contentid"]; if ($contentid == "") {$contentid = 0;} $contenttypeid = $_POST["contenttypeid"]; $title = $_POST["title"]; $subtitle = $_POST["subtitle"]; $body = $_POST["body"]; $SQL = "INSERT INTO em_content (ContentTypeID, UserID, Title, Subtitle, Body, DateAdded) VALUES (" . $contenttypeid . ", 1, '" . $title . "', '" . $subtitle . "', '" . $body . "', CURRENT_TIMESTAMP)"; $con = mysql_connect("localhost","kccdenve","kccit1"); mysql_select_db("kccdenve_km", $con); mysql_query($SQL); if (!mysql_query($SQL,$con)){ die('Error: ' . mysql_error() . '<br/><br/>' . $SQL); } mysql_close($con); echo "done..."; ?> As you can see I grab the items in the $_POST, set them to variables and generate an INSERT statement. I then connect to my DB and run the INSERT statement using mysql_query(). The problem is, after the INSERT statement runs, I look at the em_content table that it was supposed to make the INSERT to, and there are two rows of the exact same data. I have an auto incrementing ID set up as the PK of the em_content table so the value of that column is different but otherwise the two rows are exactly the same. The code above is ALL the code I have on the second page. I stripped everything else out to try to isolate the issue but in the end, it still inserts the row twice. I obviously need it to just insert once. Has anyone run into this issue before? If so pleeeeaaase help!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.