![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() ![]() |
I have been trying to get a script to work that lets the user upload a picture through an html form. Coding it is the easy part.....for some reason, that i can't explain why file uploads (through an html form) won't work on my server. I tryed fooling around with the php.ini file and httpd.conf file. Nothing i've tryed has seemed to work. I have noticed one thing: The var $HTTP_POST_FILES and $_FILES (there really the same thing.) arn't getting set. I am thinking that the file isn't getting uploaded to the server tmp dir. here's the code that i am using:
$file = $_FILES['testfile']['tmp_name'];
$path = "/usr/local/web/";
$dest = "";
$size = getimagesize($file);
echo $file . "<-- The File On The System!<br>";
echo $size . "<-- The Size!<br>";
switch ($size)
{
* * * * * *case 0:
* * * * * * * * * * * *echo "Image is unknowen";
* * * * * * * * * * * *break;
* * * * * * *case 1:
* * * * * * * * * * * *echo "Images is a GIF";
* * * * * * * * * * * *$dest = $path.uniqid('img').'gif';
* * * * * * * * * * * * *break;
* * * * * * *case 2:
* * * * * * * * * * * *echo "Image is a JPG";
* * * * * * * * * * * *$dest = $path.uniqid('img').'gif';
* * * * * * * * * * * *break;
* * * * * * *case 3:
* * * * * * * * * * * * *echo "Image is a PNG";
* * * * * * * * * * * * *$dest = $path.uniqid('img').'gif';
* ** * * * * * * * * * * *break;
* }
* *if ($dest != "")
* *{
* * * * * * * *if (move_uploaded_file($file, $dest))
* * * * * * *{
* * * * * * * *echo "File moved.";
* * * * * * *}
* * * * * * *else
* * * * * * *{
* * * * * * * * * * * *echo "Could not move the file.";
* * * * * * *}
* * *}Anyways, the part where i echo the file names and shit at the top only outputs the text that i apended to it, nothing else. Anyways, does anybody here have a clue to what's going on? I think the whole problem is to do with apache and slackware, but i am not sure. Thanks for the help in advance.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#2 | |
|
Newbie
Join Date: Jul 2004
Posts: 7
Rep Power: 0
![]() |
For Apache, I am not sure if it will work, but in AddType, did you add the PHP?
If not, add the foolwing code: Quote:
__________________
Currently Learning: <span style='color:red'>PHP, Visual Basic, C++</span> I have learned: <span style='color:green'>HTML</span> The Hack- coming to theatres near you... |
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() ![]() |
Thanks for the reply. Yeah i have the AddType all setup...other wise my scripts wouldn't even run. The stuff you have at the bottom of your quote is for windows....not Linux. Unless there's equlivant directives for linux, there not really that much help. I will look around for their linux counter parts.
Thanks again. -Pizentios
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
I figured it out. You seem to need to use fopen to open the file when it's in the system temp file in order to access it, makes sence i guess. Thanks for you're help though.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#5 |
|
Programming Guru
![]() ![]() ![]() |
Ahhhh
Answered before I got to it. Glad that you got it working!
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
Did you have the same answer??
-Pizentios
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#7 |
|
Programming Guru
![]() ![]() ![]() |
Nah. I was going to send you an easier to follow upload script.
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#8 | |
|
Expert Programmer
|
Quote:
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
|
|
|
#9 | |
|
Programming Guru
![]() ![]() |
Quote:
-Pizentios
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
|
#10 | |
|
Programming Guru
![]() ![]() |
Quote:
-Pizentios
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|