21, November 2008

Getting it to work... - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Getting it to work...
« previous next »
Pages: [1] Print

Author Topic: Getting it to work...  (Read 1938 times)
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« on: Aug 04, 2006, 07:17:51 PM »

Hi,

I'm very new to php, so perhaps I'm jumping in the deep end. Never-the-less, I'm not sure how to actually get this Easy PHP Upload to work on my website. Using the code I always get:

Notice: Undefined index: upload in */PHPdirectory/* on line 125
Notice: Undefined index: upload in */PHPdirectory/* on line 126
Notice: Undefined index: upload in */PHPdirectory/* on line 127

Which are the stared lines of this code respectively.
Code:
if (isset($_POST['Submit']) && $_POST['Submit'] == "Upload") {
1$foto_upload->the_temp_file = $_FILES['upload']['tmp_name']; *
$foto_upload->the_file = $_FILES['upload']['name'];                   *
$foto_upload->http_error = $_FILES['upload']['error'];1              *
$foto_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true
$foto_upload->do_filename_check = "n";
if ($foto_upload->upload()) {
$foto_upload->process_image(false, true, true, 80);
$foto_upload->message[] = "Processed foto: ".$foto_upload->file_copy."!"; // "file_copy is the name of the foto"
}
}

When I use the upload_example.php I don't get any errors, but it doesn't upload anything either.  Huh
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Aug 04, 2006, 08:59:16 PM »

what is the upload form you are using? (only the code between the form tags)


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #2 on: Aug 05, 2006, 12:55:50 AM »

On my page, I'm using:

Code:
<label for="category">Category of Photo</label>
<select name="category">
<option value="" seleced="selected">...</option>
<option value="More">More coming soon</option>
</select></div><br />

  <form action="uploadphp.php" method="post" enctype="multipart/form-data" name="form1">
<input type="hidden" name="MAX_FILE_SIZE" value="81920" />
<div>
  <label for="upload">Select a file</label>
  <input type="file" name="upload" id="upload" size="30" />
</div>

<div>
  <label for="replace">Replace?</label>
  <input type="checkbox" name="replace" id="replace" value="y" />
</div>

<div>
  <input type="submit" name="Submit" id="Submit" value="Upload" />
</div>
  </form>  
<p><?php echo $error?></p>

I adpated that from the script demo I believe.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Aug 05, 2006, 01:00:47 AM »

is this part OK?

<form action="uploadphp.php"


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #4 on: Aug 06, 2006, 04:06:24 PM »

is this part OK?

<form action="uploadphp.php"

Well.. uploadphp.php is the file that has the upload code in it. The form does call it. I changed the name from foto_upload.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Aug 06, 2006, 05:04:09 PM »

is this part OK?

<form action="uploadphp.php"
do you
Well.. uploadphp.php is the file that has the upload code in it. The form does call it. I changed the name from foto_upload.
please post the whole file here (as an attachment)


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #6 on: Aug 07, 2006, 05:42:06 PM »

Uploaded as a txt file, since you can't upload php. But no problem there really.

* uploadphp.txt (8.45 KB - downloaded 3 times.)
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Aug 07, 2006, 09:10:49 PM »

works fine (windows and linux)

the only thing that looks strange are these rows:
Code:
$foto_upload->foto_folder = $_SERVER['DOCUMENT_ROOT']."//pictures/upload/photo/";
$foto_upload->thumb_folder = $_SERVER['DOCUMENT_ROOT']."//pictures/upload/thumb/";

not the double slashes, please post url where the file have to work...


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #8 on: Aug 08, 2006, 07:53:22 PM »

http://www.yumc.co.uk/uploadphp.php Visit through proxy

That's the page where users will be able to upload pictures.. It isn't correctly linked from the rest of the website yet which is about to have a major update to it.

Have I got it set up to use a Database? Because I haven't created a database for it to use..
« Last Edit: Aug 08, 2006, 08:10:11 PM by HailandKill »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Aug 09, 2006, 12:55:22 AM »

No there is no database needed, I used your file on my local server without changes and it worked fine.

You are saying that the orgininal example is working on this server? please show me this file too (just change the pathes for the upload)


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #10 on: Aug 09, 2006, 02:30:27 AM »

The following files for easy upload are on my server are:

www.yumc.co.uk/uploadphp.php Visit through proxy
www.yumc.co.uk/classes/upload/upload_class.php Visit through proxy

Also, I have the example code uploaded at www.yumc.co.uk/upload_example.php Visit through proxy

While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

I have PHP Version 4.4.2 installed.. not sure whether that's a problem. More server info can be found at www.yumc.co.uk/info.php Visit through proxy
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #11 on: Aug 09, 2006, 09:02:28 AM »

I can't see what is the problem:

Quote
While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

it doesn't work for me  Sad

after the upload there must be an success message.

EDIT: one is strange here, this is what I get if I upload with you modified version:

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 125

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 126

Notice: Undefined index: upload in /usr/local/home/httpd/vhtdocs/yumc.co.uk/uploadphp.php on line 127


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #12 on: Aug 09, 2006, 05:13:45 PM »

I can't see what is the problem:

Quote
While the upload_example doesn't give any errors, new pictures appear to be uploaded into the directory.

it doesn't work for me  Sad

That was actually a typo for me.. I meant to say new pictures don't appear.

Those were also the errors that I got. All I can think of now is that there is something wrong with the PHP on my server. I don't suppose if I'd have my php.ini file configured incorrectly things would go wrong..? Although a phpBB forum works happily on the same forum.

It's these three lines it doesn't like:

Code:
$foto_upload->the_temp_file = $_FILES['upload']['tmp_name'];
$foto_upload->the_file = $_FILES['upload']['name'];
$foto_upload->http_error = $_FILES['upload']['error'];
« Last Edit: Aug 09, 2006, 05:18:28 PM by HailandKill »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #13 on: Aug 09, 2006, 06:12:56 PM »



That was actually a typo for me.. I meant to say new pictures don't appear.

Those were also the errors that I got. All I can think of now is that there is something wrong with the PHP on my server. I don't suppose if I'd have my php.ini file configured incorrectly things would go wrong..? Although a phpBB forum works happily on the same forum.

It's these three lines it doesn't like:

Code:
$foto_upload->the_temp_file = $_FILES['upload']['tmp_name'];
$foto_upload->the_file = $_FILES['upload']['name'];
$foto_upload->http_error = $_FILES['upload']['error'];

the code above is really standaard...it looks to me that these array isn't accepted, place the code above the three rows:
Code:
print_r($_FILES);

and then try this old fashioned code:

Code:
print_r($HTTP_POST_FILES);

and tell me what you see...


Last blog : Just a better Internet portal provided by Google
Atari ST fan
*
Posts: 8
52 credits
Members referred : 0


« Reply #14 on: Aug 09, 2006, 06:16:08 PM »

I think I've found the problem... in the php.ini file it said

file_uploads = Off

I have now changed this to file_uploads = On and it is now uploading!

I feel a little stupid for not checking there, thanks for all the help you've been giving me, olaf!
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6435
39434 credits
Members referred : 374


It's time to use PHP5!


« Reply #15 on: Aug 09, 2006, 06:56:54 PM »

Wink
Quote
I feel a little stupid for not checking there, thanks for all the help you've been giving me, olaf!
you know where to find the donation links on my site Smiley


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3546
Tags : php forums phpBB databases php.ini Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: Getting it to work...
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Nov 21, 2008, 05:48:21 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.714
Total Topics: 7.646
Total Members: 4.390
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: panetolikos

32 Guests, 4 Users online :

20 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.