Problem of Upload media file

Problem of Upload media file

am 17.11.2005 17:58:15 von Mohamed Yusuf

------=_Part_49600_14218540.1132246695571
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I am trying to upload music file to server using php and saving file path t=
o
the MySql, But I am getting this error message "*Warning*:
move_uploaded_file(music/media/): failed to open stream: No such file or
directory in */home/somally/public_html/music/upload2.php* on line *36*".
line 36 is reference of this code *$uploadDir =3D 'www/music/media/';*
so what am I missing?, any help?

------=_Part_49600_14218540.1132246695571--

RE: Problem of Upload media file

am 17.11.2005 18:02:30 von Bastien Koert

Check your permissions on the folder...you may need to make them 777 to
allow read/write by all for the upload

Bastien


>From: Mohamed Yusuf
>To: php-db@lists.php.net
>Subject: [PHP-DB] Problem of Upload media file
>Date: Thu, 17 Nov 2005 08:58:15 -0800
>
>I am trying to upload music file to server using php and saving file path
>to
>the MySql, But I am getting this error message "*Warning*:
>move_uploaded_file(music/media/): failed to open stream: No such file or
>directory in */home/somally/public_html/music/upload2.php* on line *36*".
> line 36 is reference of this code *$uploadDir = 'www/music/media/';*
> so what am I missing?, any help?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem of Upload media file

am 17.11.2005 18:14:01 von Mohamed Yusuf

------=_Part_49820_18981085.1132247641093
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

the permissions are right, I mean they are all setted to 777.

On 11/17/05, Bastien Koert wrote:
>
> Check your permissions on the folder...you may need to make them 777 to
> allow read/write by all for the upload
>
> Bastien
>
>
> >From: Mohamed Yusuf
> >To: php-db@lists.php.net
> >Subject: [PHP-DB] Problem of Upload media file
> >Date: Thu, 17 Nov 2005 08:58:15 -0800
> >
> >I am trying to upload music file to server using php and saving file pat=
h
> >to
> >the MySql, But I am getting this error message "*Warning*:
> >move_uploaded_file(music/media/): failed to open stream: No such file or
> >directory in */home/somally/public_html/music/upload2.php* on line *36*"=
..
> > line 36 is reference of this code *$uploadDir =3D 'www/music/media/';*
> > so what am I missing?, any help?
>
>
>

------=_Part_49820_18981085.1132247641093--

Re: Problem of Upload media file

am 17.11.2005 18:28:09 von Micah Stevens

Keep in mind you're referring to a filesystem path, and a relative one to
boot, so what you're telling php is, that your upload directory is:

/home/somally/public_html/music/music/media/

Which doesn't sound like what you intend.

Also don't trust the php line numbers if you have significant whitespace in
your code, sometimes it can get screwey. Look for your move_uploaded_file
statement.

-Micah


On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> I am trying to upload music file to server using php and saving file path
> to the MySql, But I am getting this error message "*Warning*:
> move_uploaded_file(music/media/): failed to open stream: No such file or
> directory in */home/somally/public_html/music/upload2.php* on line *36*".
> line 36 is reference of this code *$uploadDir = 'www/music/media/';*
> so what am I missing?, any help?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem of Upload media file

am 17.11.2005 18:41:04 von Mohamed Yusuf

------=_Part_50256_21089597.1132249264049
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

here is the complete code, so you can check it
==================== =====3D=
==================== ===3D


$uploadDir =3D 'www/media/';


if(isset($_POST['upload']))
{
$fileName =3D $_FILES['userfile']['name'];
$tmpName =3D $_FILES['userfile']['tmp_name'];
$fileSize =3D $_FILES['userfile']['size'];
$fileType =3D $_FILES['userfile']['type'];

// the files will be saved in filePath
$filePath =3D $uploadDir . $fileName;

$result =3D move_uploaded_file($tmpName, $filePath);
if (!$result) {
echo "Error uploading file";
exit;
}

include 'library/config.php';
include 'library/opendb.php';

if(!get_magic_quotes_gpc())
{
$fileName =3D addslashes($fileName);
$filePath =3D addslashes($filePath);
}

$query =3D "INSERT INTO upload2 (name, size, type, path ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";

mysql_query($query) or die('Error, query failed : ' . mysql_error());

include 'library/closedb.php';

echo "
File uploaded
";
}
?>
==================== =====3D=
==================== ===3D
end
On 11/17/05, Micah Stevens wrote:
>
>
> Keep in mind you're referring to a filesystem path, and a relative one to
> boot, so what you're telling php is, that your upload directory is:
>
> /home/somally/public_html/music/music/media/
>
> Which doesn't sound like what you intend.
>
> Also don't trust the php line numbers if you have significant whitespace
> in
> your code, sometimes it can get screwey. Look for your move_uploaded_file
> statement.
>
> -Micah
>
>
> On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> > I am trying to upload music file to server using php and saving file
> path
> > to the MySql, But I am getting this error message "*Warning*:
> > move_uploaded_file(music/media/): failed to open stream: No such file o=
r
> > directory in */home/somally/public_html/music/upload2.php* on line
> *36*".
> > line 36 is reference of this code *$uploadDir =3D 'www/music/media/';*
> > so what am I missing?, any help?
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_50256_21089597.1132249264049--

Re: Problem of Upload media file

am 17.11.2005 19:23:21 von Micah Stevens

Well, the error doesn't match the code, but the code says to upload the file
to:

/home/somally/public_html/music/www/media/

Is that correct?


On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
> here is the complete code, so you can check it
> ================================================
>
> >
> $uploadDir = 'www/media/';
>
>
> if(isset($_POST['upload']))
> {
> $fileName = $_FILES['userfile']['name'];
> $tmpName = $_FILES['userfile']['tmp_name'];
> $fileSize = $_FILES['userfile']['size'];
> $fileType = $_FILES['userfile']['type'];
>
> // the files will be saved in filePath
> $filePath = $uploadDir . $fileName;
>
> $result = move_uploaded_file($tmpName, $filePath);
> if (!$result) {
> echo "Error uploading file";
> exit;
> }
>
> include 'library/config.php';
> include 'library/opendb.php';
>
> if(!get_magic_quotes_gpc())
> {
> $fileName = addslashes($fileName);
> $filePath = addslashes($filePath);
> }
>
> $query = "INSERT INTO upload2 (name, size, type, path ) ".
> "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
>
> mysql_query($query) or die('Error, query failed : ' . mysql_error());
>
> include 'library/closedb.php';
>
> echo "
File uploaded
";
> }
> ?>
> ================================================
> end
>
> On 11/17/05, Micah Stevens wrote:
> > Keep in mind you're referring to a filesystem path, and a relative one to
> > boot, so what you're telling php is, that your upload directory is:
> >
> > /home/somally/public_html/music/music/media/
> >
> > Which doesn't sound like what you intend.
> >
> > Also don't trust the php line numbers if you have significant whitespace
> > in
> > your code, sometimes it can get screwey. Look for your move_uploaded_file
> > statement.
> >
> > -Micah
> >
> > On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> > > I am trying to upload music file to server using php and saving file
> >
> > path
> >
> > > to the MySql, But I am getting this error message "*Warning*:
> > > move_uploaded_file(music/media/): failed to open stream: No such file
> > > or directory in */home/somally/public_html/music/upload2.php* on line
> >
> > *36*".
> >
> > > line 36 is reference of this code *$uploadDir = 'www/music/media/';*
> > > so what am I missing?, any help?
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem of Upload media file

am 17.11.2005 19:40:54 von Mohamed Yusuf

------=_Part_51212_2710004.1132252854913
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

so should I change the directory?
where I want to upload file is
www.somalilyrics.com/music/media/=
,
therefore what about if I say
*$uploadDir =3D 'music/media/'; *is that fine?
if it is not fine would you please show me how I have to do it?


On 11/17/05, Micah Stevens wrote:
>
>
>
> Well, the error doesn't match the code, but the code says to upload the
> file
> to:
>
> /home/somally/public_html/music/www/media/
>
> Is that correct?
>
>
> On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
> > here is the complete code, so you can check it
> > ==================== ===3D=
==================== =====3D
> >
> > > >
> > $uploadDir =3D 'www/media/';
> >
> >
> > if(isset($_POST['upload']))
> > {
> > $fileName =3D $_FILES['userfile']['name'];
> > $tmpName =3D $_FILES['userfile']['tmp_name'];
> > $fileSize =3D $_FILES['userfile']['size'];
> > $fileType =3D $_FILES['userfile']['type'];
> >
> > // the files will be saved in filePath
> > $filePath =3D $uploadDir . $fileName;
> >
> > $result =3D move_uploaded_file($tmpName, $filePath);
> > if (!$result) {
> > echo "Error uploading file";
> > exit;
> > }
> >
> > include 'library/config.php';
> > include 'library/opendb.php';
> >
> > if(!get_magic_quotes_gpc())
> > {
> > $fileName =3D addslashes($fileName);
> > $filePath =3D addslashes($filePath);
> > }
> >
> > $query =3D "INSERT INTO upload2 (name, size, type, path ) ".
> > "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
> >
> > mysql_query($query) or die('Error, query failed : ' . mysql_error());
> >
> > include 'library/closedb.php';
> >
> > echo "
File uploaded
";
> > }
> > ?>
> > ==================== ===3D=
==================== =====3D
> > end
> >
> > On 11/17/05, Micah Stevens wrote:
> > > Keep in mind you're referring to a filesystem path, and a relative on=
e
> to
> > > boot, so what you're telling php is, that your upload directory is:
> > >
> > > /home/somally/public_html/music/music/media/
> > >
> > > Which doesn't sound like what you intend.
> > >
> > > Also don't trust the php line numbers if you have significant
> whitespace
> > > in
> > > your code, sometimes it can get screwey. Look for your
> move_uploaded_file
> > > statement.
> > >
> > > -Micah
> > >
> > > On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> > > > I am trying to upload music file to server using php and saving fil=
e
> > >
> > > path
> > >
> > > > to the MySql, But I am getting this error message "*Warning*:
> > > > move_uploaded_file(music/media/): failed to open stream: No such
> file
> > > > or directory in */home/somally/public_html/music/upload2.php* on
> line
> > >
> > > *36*".
> > >
> > > > line 36 is reference of this code *$uploadDir =3D 'www/music/media/=
';*
> > > > so what am I missing?, any help?
> > >
> > > --
> > > PHP Database Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
>

------=_Part_51212_2710004.1132252854913--

Re: Problem of Upload media file

am 17.11.2005 20:19:46 von Micah Stevens

No. It's not okay.. you're already in the music directory.. if you want it in
the media subdir, just put 'media/'



On Thursday 17 November 2005 10:40 am, Mohamed Yusuf wrote:
> so should I change the directory?
> where I want to upload file is
> www.somalilyrics.com/music/media/
>, therefore what about if I say
> *$uploadDir = 'music/media/'; *is that fine?
> if it is not fine would you please show me how I have to do it?
>
> On 11/17/05, Micah Stevens wrote:
> > Well, the error doesn't match the code, but the code says to upload the
> > file
> > to:
> >
> > /home/somally/public_html/music/www/media/
> >
> > Is that correct?
> >
> > On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
> > > here is the complete code, so you can check it
> > > ================================================
> > >
> > > > > >
> > > $uploadDir = 'www/media/';
> > >
> > >
> > > if(isset($_POST['upload']))
> > > {
> > > $fileName = $_FILES['userfile']['name'];
> > > $tmpName = $_FILES['userfile']['tmp_name'];
> > > $fileSize = $_FILES['userfile']['size'];
> > > $fileType = $_FILES['userfile']['type'];
> > >
> > > // the files will be saved in filePath
> > > $filePath = $uploadDir . $fileName;
> > >
> > > $result = move_uploaded_file($tmpName, $filePath);
> > > if (!$result) {
> > > echo "Error uploading file";
> > > exit;
> > > }
> > >
> > > include 'library/config.php';
> > > include 'library/opendb.php';
> > >
> > > if(!get_magic_quotes_gpc())
> > > {
> > > $fileName = addslashes($fileName);
> > > $filePath = addslashes($filePath);
> > > }
> > >
> > > $query = "INSERT INTO upload2 (name, size, type, path ) ".
> > > "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
> > >
> > > mysql_query($query) or die('Error, query failed : ' . mysql_error());
> > >
> > > include 'library/closedb.php';
> > >
> > > echo "
File uploaded
";
> > > }
> > > ?>
> > > ================================================
> > > end
> > >
> > > On 11/17/05, Micah Stevens wrote:
> > > > Keep in mind you're referring to a filesystem path, and a relative
> > > > one
> >
> > to
> >
> > > > boot, so what you're telling php is, that your upload directory is:
> > > >
> > > > /home/somally/public_html/music/music/media/
> > > >
> > > > Which doesn't sound like what you intend.
> > > >
> > > > Also don't trust the php line numbers if you have significant
> >
> > whitespace
> >
> > > > in
> > > > your code, sometimes it can get screwey. Look for your
> >
> > move_uploaded_file
> >
> > > > statement.
> > > >
> > > > -Micah
> > > >
> > > > On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> > > > > I am trying to upload music file to server using php and saving
> > > > > file
> > > >
> > > > path
> > > >
> > > > > to the MySql, But I am getting this error message "*Warning*:
> > > > > move_uploaded_file(music/media/): failed to open stream: No such
> >
> > file
> >
> > > > > or directory in */home/somally/public_html/music/upload2.php* on
> >
> > line
> >
> > > > *36*".
> > > >
> > > > > line 36 is reference of this code *$uploadDir =
> > > > > 'www/music/media/';* so what am I missing?, any help?
> > > >
> > > > --
> > > > PHP Database Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problem of Upload media file

am 17.11.2005 20:51:45 von Mohamed Yusuf

------=_Part_52152_2916779.1132257105802
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Many thanks for your help. it works.

On 11/17/05, Micah Stevens wrote:
>
>
> No. It's not okay.. you're already in the music directory.. if you want i=
t
> in
> the media subdir, just put 'media/'
>
>
>
> On Thursday 17 November 2005 10:40 am, Mohamed Yusuf wrote:
> > so should I change the directory?
> > where I want to upload file is
> > www.somalilyrics.com/music/media/ ia/>
>
> >, therefore what about if I say
> > *$uploadDir =3D 'music/media/'; *is that fine?
> > if it is not fine would you please show me how I have to do it?
> >
> > On 11/17/05, Micah Stevens wrote:
> > > Well, the error doesn't match the code, but the code says to upload
> the
> > > file
> > > to:
> > >
> > > /home/somally/public_html/music/www/media/
> > >
> > > Is that correct?
> > >
> > > On Thursday 17 November 2005 9:41 am, Mohamed Yusuf wrote:
> > > > here is the complete code, so you can check it
> > > > ==================== ===
==================== =====3D=
=3D
> > > >
> > > > > > > >
> > > > $uploadDir =3D 'www/media/';
> > > >
> > > >
> > > > if(isset($_POST['upload']))
> > > > {
> > > > $fileName =3D $_FILES['userfile']['name'];
> > > > $tmpName =3D $_FILES['userfile']['tmp_name'];
> > > > $fileSize =3D $_FILES['userfile']['size'];
> > > > $fileType =3D $_FILES['userfile']['type'];
> > > >
> > > > // the files will be saved in filePath
> > > > $filePath =3D $uploadDir . $fileName;
> > > >
> > > > $result =3D move_uploaded_file($tmpName, $filePath);
> > > > if (!$result) {
> > > > echo "Error uploading file";
> > > > exit;
> > > > }
> > > >
> > > > include 'library/config.php';
> > > > include 'library/opendb.php';
> > > >
> > > > if(!get_magic_quotes_gpc())
> > > > {
> > > > $fileName =3D addslashes($fileName);
> > > > $filePath =3D addslashes($filePath);
> > > > }
> > > >
> > > > $query =3D "INSERT INTO upload2 (name, size, type, path ) ".
> > > > "VALUES ('$fileName', '$fileSize', '$fileType', '$filePath')";
> > > >
> > > > mysql_query($query) or die('Error, query failed : ' .
> mysql_error());
> > > >
> > > > include 'library/closedb.php';
> > > >
> > > > echo "
File uploaded
";
> > > > }
> > > > ?>
> > > > ==================== ===
==================== =====3D=
=3D
> > > > end
> > > >
> > > > On 11/17/05, Micah Stevens wrote:
> > > > > Keep in mind you're referring to a filesystem path, and a relativ=
e
> > > > > one
> > >
> > > to
> > >
> > > > > boot, so what you're telling php is, that your upload directory
> is:
> > > > >
> > > > > /home/somally/public_html/music/music/media/
> > > > >
> > > > > Which doesn't sound like what you intend.
> > > > >
> > > > > Also don't trust the php line numbers if you have significant
> > >
> > > whitespace
> > >
> > > > > in
> > > > > your code, sometimes it can get screwey. Look for your
> > >
> > > move_uploaded_file
> > >
> > > > > statement.
> > > > >
> > > > > -Micah
> > > > >
> > > > > On Thursday 17 November 2005 8:58 am, Mohamed Yusuf wrote:
> > > > > > I am trying to upload music file to server using php and saving
> > > > > > file
> > > > >
> > > > > path
> > > > >
> > > > > > to the MySql, But I am getting this error message "*Warning*:
> > > > > > move_uploaded_file(music/media/): failed to open stream: No suc=
h
> > >
> > > file
> > >
> > > > > > or directory in */home/somally/public_html/music/upload2.php* o=
n
> > >
> > > line
> > >
> > > > > *36*".
> > > > >
> > > > > > line 36 is reference of this code *$uploadDir =3D
> > > > > > 'www/music/media/';* so what am I missing?, any help?
> > > > >
> > > > > --
> > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

------=_Part_52152_2916779.1132257105802--