Heya guys, i got this simple script to work and now it doesnt.Its far from completed, i know, i just want it to gogogo so i can expand it to include my preferences and a few hidden fields.
I can't tell if i screwed up the code or its a server related problem. here goes.... - <html>
-
<body>
-
<form action="upload.php" method="post" ENCTYPE="multipart/form-data">
-
<input type="file" name="file" size="30" />
-
<input type="submit" value="gogogo" />
-
</form>
-
</body>
-
</html>
-
[PHP]
$uploaddir = "/var/www/html/gallery";
if(is_uploaded_file($_FILES['file']['tmp_name']))
{
move_uploaded_file($_FILES['file']['tmp_name'],$uploaddir.'/'. $_FILES['file']['name']);
};
echo "Completed";
[/PHP]
13 2019
[PHP]$uploaddir = "/var/www/html/gallery"; [/PHP]
remove "/" from the beginning of the path and put a "/" to the end check it.
[PHP]$uploaddir = "var/www/html/gallery/"; [/PHP]
if your files are listed with gallery folder {all are in same DIR} simply this also work.
but make sure to assign the write permission to the folder if its remote server.
[PHP]$uploaddir = "gallery/"; [/PHP]
thanx for you're input ajax, i tried the different variations but to no avail, (on a remote server btw). it seems such a simple script.
[directories and permissions]
/ -- var -- 755 / www-- 755 / html -- 755 | -- gallery -- 777
| -- form.php -- 755
| -- upload.php -- 755
I just noticed that my phpinfo() returns upload_tmp_dir = novalue but file_uploads = On. is that correct?
thanx for you're input ajax, i tried the different variations but to no avail, (on a remote server btw). it seems such a simple script.
[directories and permissions]
/ -- var -- 755 / www-- 755 / html -- 755 | -- gallery -- 777
| -- form.php -- 755
| -- upload.php -- 755
I just noticed that my phpinfo() returns upload_tmp_dir = novalue but file_uploads = On. is that correct?
Put your form.php,upload.php and gallery in side one dir we will say www dir.then set your variable like this.
[PHP]$uploaddir = "gallery/"; // Note only single "/"[/PHP]
make sure to set 777 for gallery dir and give it a try again.
and remove the file size="30" from the form for now.
[quote=ajaxrand]Put your form.php,upload.php and gallery in side one dir we will say www dirQUOTE]
thx ajax, but my root.dir is html. i put them i a subfolder, rechecked my permissions, still no go. tried the new path, still no go, tried variations of the path, still no go. its hard to believe it actually worked.
[quote=jungabunga]
Put your form.php,upload.php and gallery in side one dir we will say www dirQUOTE]
thx ajax, but my root.dir is html. i put them i a subfolder, rechecked my permissions, still no go. tried the new path, still no go, tried variations of the path, still no go. its hard to believe it actually worked.
Sorry I didn't get u.Is it working or Not?
Try this one just execute this after creating directory named myfiles with 777.
put php script and myfiles folder in same place.
[PHP]<?php
$target_path = "myfiles/"; //Directory Name to Upload
if($_POST['upload'])
{
$newName = md5(basename($_FILES['upload_fle']['name']));
$ext = strrchr(basename($_FILES['upload_fle']['name']), ".");
$fullName = $newName.$ext;
if(move_uploaded_file($_FILES['upload_fle']['tmp_name'], $target_path.$fullName))
{
echo "The file ". basename( $_FILES['upload_fle']['name']).
" has been uploaded with this name : ".$fullName;
} else
{
echo "There was an error uploading the file, please try again!";
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="<? echo $PHP_SELF; ?>" method="post" enctype="multipart/form-data" name="frmAlbum" id="frmAlbum">
<input name="upload_fle" type="file" id="upload_fle"/>
<BR>
<input name="upload" type="submit" value="Upload">
</form>
</body>
</html>[/PHP]
cheers, but i got the
There was an error uploading the file, please try again!
This script is working in my web server. even your one also working. if it is not working in your end its your bad luck.BTW what type of files you tried to upload.
Don't go for massive files, just upload simple text files first of all. there are limitation for huge files from the php level.
yeah im only trying small files. i wonder what i did. i might just reinstall web then, thx for the persistance dude.
yeah im only trying small files. i wonder what i did. i might just reinstall web then, thx for the persistance dude.
Don' t give up, give it a try. hope you will get the solution. ;)
Don' t give up, give it a try. hope you will get the solution. ;)
I musta screwed up the permissions on teh server or something. i resinalled my micro version of fedora and it works fine now :P
I musta screwed up the permissions on teh server or something. i resinalled my micro version of fedora and it works fine now :P
Great work.. :) c u l8r.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: kafooey |
last post by:
Hi all,
I've been digging around on the newsgroups and the web for a possible
answer for this problem, but have so far come up with nothing so
thought I would ask here...
I have the following...
|
by: Sky Sigal |
last post by:
I have created an IHttpHandler that waits for uploads as attachments for a
webmail interface, and saves it to a directory that is defined in
config.xml.
My question is the following:
assuming...
|
by: Kikoz |
last post by:
Hi all.
I assume that if the user uploads a file from aspx page IIS will put all
future requests to the same page from other users in a line and all of them
will be waiting until this upload...
|
by: John |
last post by:
Hi all,
How do I programmatically save an uploaded file (using the File Field
control) to a sub folder of a web site.
I've tried specifying ..SaveAs("~Uploads/" & "fielname") but it keeps...
|
by: yehaimanish |
last post by:
I am developing the project management system.
Each Project:
1. Title, description ... , stored in mysql database
2. Upto ten files (initial description), (name in db, file in file
system)
3....
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: markus.rietzler |
last post by:
i want to do (multiple) file upload(s) and display a progress bar.
with firefox and safari it is no problem at all. only IE makes some
problems.
my script is based on ajax-uploader, which can be...
|
by: Emmanuel Petit |
last post by:
First of all I am rather new into PHP. I use php 5 and I am putting
together a web site for a local association I belong too.
Most of the site is okay, except for this problem :
I need to be...
|
by: Milan Krejci |
last post by:
while(list($key,$value) = each($_FILES))
{
if(!empty($value)){
$filename = $value;
$add = "upimg/$filename";
echo $_FILES;
$error=copy($_FILES, $add);
if (!$error)...
|
by: =?ISO-8859-1?B?UOlw6g==?= |
last post by:
Hello.
Im new to php and i had experience in ASP.
IM trying to get a pdf file from a remote folder and what happens is
that opens a new page.
Here is the code:
<a...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |