Jump to content

Help with Image Upload


sailorsmokey

Recommended Posts

Hi everyone,

 

I'm trying to keep this so basic, and for some reason it's not working.  (Okay, yes, we all know that it's not "some" reason - but really because sailorsmokey is not understanding the tutorials or the code she is trying to write.)

 

All I want is the image from the HTML form to be loaded onto a directory on the site.  Yes, I have changed permission on the directory to 777.  I'm sure the problem is in the code I am trying to understand and duplicate from tutorials online. 

 

So, without being too brutal, could someone point out what I'm doing wrong?

 

Here's the form code:

<table border="0">
<form enctype="multipart/form-data" method="post" action="completemodify.php" >
<tr><td valign="top">
UNDER CONSTRUCTION - NOT WORKING YET Additional Info Image (if you have one):</td><td colspan="2">
<input type="file" name="additionalpix" size="30" />
<tr colspan="2">
<input type="Submit" name="completemodify" value="Make the Above Changes">
</tr>
</td></tr></table>

 

Here's the processing code:

<?
$additionalpix=$_FILES['additionalpix']['tmp_name'];
$additionalpix_name=$_FILES['additionalpix']['name'];

$directory_addself=str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']);
$adduploads_directory=$_SERVER['DOCUMENT_ROOT'] . $directory_addself . 'autism/additionalpix/';
$fieldname= 'additionalpix';
$adduploadfilename=$adduploads_directory.$_FILES[$fieldname]['name'];
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $adduploadFilename);

 

PS - Oh yes, just reading this it doesn't make sense to me.  Again, I'm pretty sure I'm not understanding something key here.  Any help/pointers/advice anyone could give would really give me something to go on here.  Thank you in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.