Form with browse for file to upload "ftp"

Form with browse for file to upload "ftp"

am 22.11.2003 20:04:20 von Paul Ferrie

Getting bit of a regular on here :)

I am hoping that someone can point me to a script that allows me to attach a
file to be uploaded to a set dir.
I have already got the form built, except for a browse file option.
The form is part of this admin area
http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
Instead of having a textfield displaying a url of the image and the admin
having to upload it sepratly i thought that i could get the admin to upload
the image via the form. keeps it altogether.

I wouldnt know were to begin adding this to the form. i am pretty sure
there a pre-built script that can do this. Can someone point me to one. i
had a quick look but came up with very little.

Cheers
Paul

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 20:20:18 von Nathan Taylor

------=_NextPart_000_000D_01C3B103.C12CC1E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

There is nothing special to be done with the form itself for it to =
support file uploading aside from supply a browse field:



As for uploading it, here's some untested code:

if(!empty($_FILES['file']['tmp_name'])) {
$name =3D strtolower(eregi_replace('#| |\?|!', '', =
$_FILES['file']['name']));
$destination =3D 'path/to/where/you/want/the/file/saved/'.$name;
if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
echo 'Successful';
} else {
echo 'Failed';
}
}
----- Original Message -----=20
From: PAUL FERRIE=20
To: php-general@lists.php.net=20
Sent: Saturday, November 22, 2003 2:04 PM
Subject: [PHP] Form with browse for file to upload "ftp"


Getting bit of a regular on here :)

I am hoping that someone can point me to a script that allows me to =
attach a
file to be uploaded to a set dir.
I have already got the form built, except for a browse file option.
The form is part of this admin area
http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
Instead of having a textfield displaying a url of the image and the =
admin
having to upload it sepratly i thought that i could get the admin to =
upload
the image via the form. keeps it altogether.

I wouldnt know were to begin adding this to the form. i am pretty =
sure
there a pre-built script that can do this. Can someone point me to =
one. i
had a quick look but came up with very little.

Cheers
Paul

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


------=_NextPart_000_000D_01C3B103.C12CC1E0--

Re: Form with browse for file to upload "ftp"

am 22.11.2003 20:20:18 von Nathan Taylor

------=_NextPart_000_000D_01C3B103.C12CC1E0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

There is nothing special to be done with the form itself for it to =
support file uploading aside from supply a browse field:



As for uploading it, here's some untested code:

if(!empty($_FILES['file']['tmp_name'])) {
$name =3D strtolower(eregi_replace('#| |\?|!', '', =
$_FILES['file']['name']));
$destination =3D 'path/to/where/you/want/the/file/saved/'.$name;
if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
echo 'Successful';
} else {
echo 'Failed';
}
}
----- Original Message -----=20
From: PAUL FERRIE=20
To: php-general@lists.php.net=20
Sent: Saturday, November 22, 2003 2:04 PM
Subject: [PHP] Form with browse for file to upload "ftp"


Getting bit of a regular on here :)

I am hoping that someone can point me to a script that allows me to =
attach a
file to be uploaded to a set dir.
I have already got the form built, except for a browse file option.
The form is part of this admin area
http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
Instead of having a textfield displaying a url of the image and the =
admin
having to upload it sepratly i thought that i could get the admin to =
upload
the image via the form. keeps it altogether.

I wouldnt know were to begin adding this to the form. i am pretty =
sure
there a pre-built script that can do this. Can someone point me to =
one. i
had a quick look but came up with very little.

Cheers
Paul

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


------=_NextPart_000_000D_01C3B103.C12CC1E0--

Re: Form with browse for file to upload "ftp"

am 22.11.2003 20:23:25 von Nathan Taylor

------=_NextPart_000_0007_01C3B104.31106750
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Oh and also, don't forget to set: enctype=3D"multipart/form-data" in the =

tag.

Nathan
----- Original Message -----=20
From: Nathan Taylor=20
To: PAUL FERRIE ; php-general@lists.php.net=20
Sent: Saturday, November 22, 2003 2:20 PM
Subject: Re: [PHP] Form with browse for file to upload "ftp"


There is nothing special to be done with the form itself for it to =
support file uploading aside from supply a browse field:



As for uploading it, here's some untested code:

if(!empty($_FILES['file']['tmp_name'])) {
$name =3D strtolower(eregi_replace('#| |\?|!', '', =
$_FILES['file']['name']));
$destination =3D 'path/to/where/you/want/the/file/saved/'.$name;
if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) =
{
echo 'Successful';
} else {
echo 'Failed';
}
}
----- Original Message -----=20
From: PAUL FERRIE=20
To: php-general@lists.php.net=20
Sent: Saturday, November 22, 2003 2:04 PM
Subject: [PHP] Form with browse for file to upload "ftp"


Getting bit of a regular on here :)

I am hoping that someone can point me to a script that allows me to =
attach a
file to be uploaded to a set dir.
I have already got the form built, except for a browse file option.
The form is part of this admin area
http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
Instead of having a textfield displaying a url of the image and the =
admin
having to upload it sepratly i thought that i could get the admin to =
upload
the image via the form. keeps it altogether.

I wouldnt know were to begin adding this to the form. i am pretty =
sure
there a pre-built script that can do this. Can someone point me to =
one. i
had a quick look but came up with very little.

Cheers
Paul

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


------=_NextPart_000_0007_01C3B104.31106750--

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:09:53 von Paul Ferrie

I am getting this error once i run the script

Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
Permission denied in /blah/blah
Do i need to set the chmod of the img folder?

Cheers
Paul


"Nathan Taylor" wrote in message
news:BAY3-DAV133X0gIxRhr0000a042@hotmail.com...
There is nothing special to be done with the form itself for it to support
file uploading aside from supply a browse field:



As for uploading it, here's some untested code:

if(!empty($_FILES['file']['tmp_name'])) {
$name = strtolower(eregi_replace('#| |\?|!', '',
$_FILES['file']['name']));
$destination = 'path/to/where/you/want/the/file/saved/'.$name;
if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
echo 'Successful';
} else {
echo 'Failed';
}
}
----- Original Message -----
From: PAUL FERRIE
To: php-general@lists.php.net
Sent: Saturday, November 22, 2003 2:04 PM
Subject: [PHP] Form with browse for file to upload "ftp"


Getting bit of a regular on here :)

I am hoping that someone can point me to a script that allows me to attach
a
file to be uploaded to a set dir.
I have already got the form built, except for a browse file option.
The form is part of this admin area
http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
Instead of having a textfield displaying a url of the image and the admin
having to upload it sepratly i thought that i could get the admin to
upload
the image via the form. keeps it altogether.

I wouldnt know were to begin adding this to the form. i am pretty sure
there a pre-built script that can do this. Can someone point me to one.
i
had a quick look but came up with very little.

Cheers
Paul

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

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

RE: Form with browse for file to upload "ftp"

am 22.11.2003 21:15:38 von Bronislav.Klucka

User executing the script (www-data or nobody or some other user) has to
vave the permission to wotk with this directory.



Brona


> I am getting this error once i run the script
>
> Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
> Permission denied in /blah/blah
> Do i need to set the chmod of the img folder?
>
> Cheers
> Paul
>
>
> "Nathan Taylor" wrote in message
> news:BAY3-DAV133X0gIxRhr0000a042@hotmail.com...
> There is nothing special to be done with the form itself for it to support
> file uploading aside from supply a browse field:
>
>
>
> As for uploading it, here's some untested code:
>
> if(!empty($_FILES['file']['tmp_name'])) {
> $name = strtolower(eregi_replace('#| |\?|!', '',
> $_FILES['file']['name']));
> $destination = 'path/to/where/you/want/the/file/saved/'.$name;
> if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
> echo 'Successful';
> } else {
> echo 'Failed';
> }
> }
> ----- Original Message -----
> From: PAUL FERRIE
> To: php-general@lists.php.net
> Sent: Saturday, November 22, 2003 2:04 PM
> Subject: [PHP] Form with browse for file to upload "ftp"
>
>
> Getting bit of a regular on here :)
>
> I am hoping that someone can point me to a script that allows
> me to attach
> a
> file to be uploaded to a set dir.
> I have already got the form built, except for a browse file option.
> The form is part of this admin area
> http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
> Instead of having a textfield displaying a url of the image and
> the admin
> having to upload it sepratly i thought that i could get the admin to
> upload
> the image via the form. keeps it altogether.
>
> I wouldnt know were to begin adding this to the form. i am pretty sure
> there a pre-built script that can do this. Can someone point me to one.
> i
> had a quick look but came up with very little.
>
> Cheers
> Paul
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:16:54 von Martin Hudec

Hello,

He said that you have to check under which user/group is your webserver=20
running (webserver is handling the scripts)... and then set the correct=20
file/directory permissions on that /blah/blah directory......

yes u have to set at least chmod.... but look to chown also...

On Saturday 22 November 2003 21:18, PAUL FERRIE wrote:
> eh?
>
> "Bronislav klu=E8ka" wrote in message
> news:PCEBLPFDMGFMKAIKPBIFGECICNAA.Bronislav.Klucka@pro2-soft .com...
>
> > User executing the script (www-data or nobody or some other user) has to
> > vave the permission to wotk with this directory.
> >
> >
> >
> > Brona
> >
> > > I am getting this error once i run the script
> > >
> > > Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
> > > Permission denied in /blah/blah
> > > Do i need to set the chmod of the img folder?
> > >
> > > Cheers
> > > Paul
> > >

=2D-=20
:
:. kind regards
:.. Martin Hudec
:.:
:.: =3Dw=3D http://www.aeternal.net
:.: =3Dm=3D +421.907.303393
:.: =3D@=3D corwin@aeternal.net
:.:
:.: "When you want something, all the universe=20
:.: conspires in helping you to achieve it."
:.: - The Alchemist (Paulo Coelho)

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:18:30 von Paul Ferrie

eh?

"Bronislav kluèka" wrote in message
news:PCEBLPFDMGFMKAIKPBIFGECICNAA.Bronislav.Klucka@pro2-soft .com...
> User executing the script (www-data or nobody or some other user) has to
> vave the permission to wotk with this directory.
>
>
>
> Brona
>
>
> > I am getting this error once i run the script
> >
> > Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
> > Permission denied in /blah/blah
> > Do i need to set the chmod of the img folder?
> >
> > Cheers
> > Paul
> >
> >
> > "Nathan Taylor" wrote in message
> > news:BAY3-DAV133X0gIxRhr0000a042@hotmail.com...
> > There is nothing special to be done with the form itself for it to
support
> > file uploading aside from supply a browse field:
> >
> >
> >
> > As for uploading it, here's some untested code:
> >
> > if(!empty($_FILES['file']['tmp_name'])) {
> > $name = strtolower(eregi_replace('#| |\?|!', '',
> > $_FILES['file']['name']));
> > $destination = 'path/to/where/you/want/the/file/saved/'.$name;
> > if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
> > echo 'Successful';
> > } else {
> > echo 'Failed';
> > }
> > }
> > ----- Original Message -----
> > From: PAUL FERRIE
> > To: php-general@lists.php.net
> > Sent: Saturday, November 22, 2003 2:04 PM
> > Subject: [PHP] Form with browse for file to upload "ftp"
> >
> >
> > Getting bit of a regular on here :)
> >
> > I am hoping that someone can point me to a script that allows
> > me to attach
> > a
> > file to be uploaded to a set dir.
> > I have already got the form built, except for a browse file option.
> > The form is part of this admin area
> > http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
> > Instead of having a textfield displaying a url of the image and
> > the admin
> > having to upload it sepratly i thought that i could get the admin to
> > upload
> > the image via the form. keeps it altogether.
> >
> > I wouldnt know were to begin adding this to the form. i am pretty
sure
> > there a pre-built script that can do this. Can someone point me to
one.
> > i
> > had a quick look but came up with very little.
> >
> > Cheers
> > Paul
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:21:00 von list-php-1

On Sat, Nov 22, 2003 at 08:18:30PM -0000, PAUL FERRIE wrote:
:
: "Bronislav kluèka" wrote in message
: news:PCEBLPFDMGFMKAIKPBIFGECICNAA.Bronislav.Klucka@pro2-soft .com...
: >
: > User executing the script (www-data or nobody or some other user) has to
: > vave the permission to wotk with this directory.
:
: eh?

I think he meant to say:

: > The user executing the script (www-data or nobody or some other user)
: > has to have the permission to work with this directory.

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:25:43 von John Nichel

PAUL FERRIE wrote:

> I am getting this error once i run the script
>
> Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
> Permission denied in /blah/blah
> Do i need to set the chmod of the img folder?
>
> Cheers
> Paul


The user or group that your webserver is running as (default for Apache:
nobody/nobody) has to have write permission in both the temp upload
directory, and the directory that you're trying to move the file to.


--
By-Tor.com
It's all about the Rush
http://www.by-tor.com

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

Re: Form with browse for file to upload "ftp"

am 22.11.2003 21:52:59 von Paul Ferrie

Got it working :)
thanks for the help

Paul

"Paul Ferrie" wrote in message
news:20031122190416.16666.qmail@pb1.pair.com...
> Getting bit of a regular on here :)
>
> I am hoping that someone can point me to a script that allows me to attach
a
> file to be uploaded to a set dir.
> I have already got the form built, except for a browse file option.
> The form is part of this admin area
> http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
> Instead of having a textfield displaying a url of the image and the admin
> having to upload it sepratly i thought that i could get the admin to
upload
> the image via the form. keeps it altogether.
>
> I wouldnt know were to begin adding this to the form. i am pretty sure
> there a pre-built script that can do this. Can someone point me to one.
i
> had a quick look but came up with very little.
>
> Cheers
> Paul

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

Re: Re: Form with browse for file to upload "ftp"

am 23.11.2003 01:34:30 von Nathan Taylor

------=_NextPart_000_0026_01C3B12F.A5F6CCA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Glad to be of service. =3D)
----- Original Message -----=20
From: PAUL FERRIE=20
To: php-general@lists.php.net=20
Sent: Saturday, November 22, 2003 3:52 PM
Subject: [PHP] Re: Form with browse for file to upload "ftp"


Got it working :)
thanks for the help

Paul

"Paul Ferrie" wrote in message
news:20031122190416.16666.qmail@pb1.pair.com...
> Getting bit of a regular on here :)
>
> I am hoping that someone can point me to a script that allows me to =
attach
a
> file to be uploaded to a set dir.
> I have already got the form built, except for a browse file option.
> The form is part of this admin area
> http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin .html
> Instead of having a textfield displaying a url of the image and the =
admin
> having to upload it sepratly i thought that i could get the admin to
upload
> the image via the form. keeps it altogether.
>
> I wouldnt know were to begin adding this to the form. i am pretty =
sure
> there a pre-built script that can do this. Can someone point me to =
one.
i
> had a quick look but came up with very little.
>
> Cheers
> Paul

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


------=_NextPart_000_0026_01C3B12F.A5F6CCA0--