PHP Basics

PHP Basics

am 09.01.2008 10:56:50 von Saravana

Hi all,

I am new to this group and I am new to PHP too.

I want to create a php page with a file browse button and I have to
add the file path in Mysql table after submit.

Kindly bring me your ideas.

Thanks,
S.SARAVANAKUMAR

Re: PHP Basics

am 09.01.2008 11:34:14 von Erwin Moller

Saravana wrote:
> Hi all,
>
> I am new to this group and I am new to PHP too.
>
> I want to create a php page with a file browse button and I have to
> add the file path in Mysql table after submit.
>
> Kindly bring me your ideas.

Hi,

The HTML part for fileuploads is easy (assuming you know HTML)
Google for file upload, follow first link:
http://www.cs.tut.fi/~jkorpela/forms/file.html

for an introduction.

About saving the file path: forget it.
Fileuploads only send the file(s) to the server, NOT the path where they
reside on the clientmachine.
Even Javascript will not help you with this: It is also crippled on
purpose when it come to real paths and files.

Reason?
It is none of the server's business where the original file is on the
client.

Regards,
Erwin Moller

>
> Thanks,
> S.SARAVANAKUMAR
>

Re: PHP Basics

am 09.01.2008 16:05:29 von Rob

On Jan 9, 10:34=A0am, Erwin Moller
wrote:
> Saravana wrote:
> > Hi all,
>
> > I am new to this group and I am new to PHP too.
>
> > I want to create a php page with a file browse button and I have to
> > add the file path in Mysql table after submit.
>
> > Kindly bring me your ideas.
>
> Hi,
>
> The HTML part for fileuploads is easy (assuming you know HTML)
> Google for file upload, follow first link:http://www.cs.tut.fi/~jkorpela/f=
orms/file.html
>
> for an introduction.
>
> About saving the file path: forget it.
> Fileuploads only send the file(s) to the server, NOT the path where they
> reside on the clientmachine.
> Even Javascript will not help you with this: It is also crippled on
> purpose when it come to real paths and files.
>
> Reason?
> It is none of the server's business where the original file is on the
> client.
>
> Regards,
> Erwin Moller
>
>
>
>
>
> > Thanks,
> > S.SARAVANAKUMAR- Hide quoted text -
>
> - Show quoted text -

Erwin - that's not strictly true.

JavaScript could be used to store the original location of the file,
like this :-





Having said that, I can't think why you would want the original
location. I think Saravana is actually asking how to store the name/
path of the file on the server, so it can be retreived.

Is that right?

Rob.

Re: PHP Basics

am 09.01.2008 18:12:14 von Erwin Moller

Rob wrote:
> On Jan 9, 10:34 am, Erwin Moller
> wrote:
>> Saravana wrote:
>>> Hi all,
>>> I am new to this group and I am new to PHP too.
>>> I want to create a php page with a file browse button and I have to
>>> add the file path in Mysql table after submit.
>>> Kindly bring me your ideas.
>> Hi,
>>
>> The HTML part for fileuploads is easy (assuming you know HTML)
>> Google for file upload, follow first link:http://www.cs.tut.fi/~jkorpela/forms/file.html
>>
>> for an introduction.
>>
>> About saving the file path: forget it.
>> Fileuploads only send the file(s) to the server, NOT the path where they
>> reside on the clientmachine.
>> Even Javascript will not help you with this: It is also crippled on
>> purpose when it come to real paths and files.
>>
>> Reason?
>> It is none of the server's business where the original file is on the
>> client.
>>
>> Regards,
>> Erwin Moller
>>
>>
>>
>>
>>
>>> Thanks,
>>> S.SARAVANAKUMAR- Hide quoted text -
>> - Show quoted text -
>
> Erwin - that's not strictly true.
>
> JavaScript could be used to store the original location of the file,
> like this :-
>
>


>
>


Hi,

You are right.
I stand corrected. :-)

It is NOT possible to modify the value(s) with JavaScript, but it is
possible to read.

Regards,
Erwin Moller

>
> Having said that, I can't think why you would want the original
> location. I think Saravana is actually asking how to store the name/
> path of the file on the server, so it can be retreived.
>
> Is that right?
>
> Rob.

Re: PHP Basics

am 10.01.2008 06:58:16 von Saravana

On Jan 9, 8:05 pm, Rob wrote:
> On Jan 9, 10:34 am, Erwin Moller
>
>
>
> wrote:
> > Saravana wrote:
> > > Hi all,
>
> > > I am new to this group and I am new to PHP too.
>
> > > I want to create a php page with a file browse button and I have to
> > > add the file path in Mysql table after submit.
>
> > > Kindly bring me your ideas.
>
> > Hi,
>
> > The HTML part for fileuploads is easy (assuming you know HTML)
> > Google for file upload, follow first link:http://www.cs.tut.fi/~jkorpela/forms/file.html
>
> > for an introduction.
>
> > About saving the file path: forget it.
> > Fileuploads only send the file(s) to the server, NOT the path where they
> > reside on the clientmachine.
> > Even Javascript will not help you with this: It is also crippled on
> > purpose when it come to real paths and files.
>
> > Reason?
> > It is none of the server's business where the original file is on the
> > client.
>
> > Regards,
> > Erwin Moller
>
> > > Thanks,
> > > S.SARAVANAKUMAR- Hide quoted text -
>
> > - Show quoted text -
>
> Erwin - that's not strictly true.
>
> JavaScript could be used to store the original location of the file,
> like this :-
>
>


>
>

>
> Having said that, I can't think why you would want the original
> location. I think Saravana is actually asking how to store the name/
> path of the file on the server, so it can be retreived.
>
> Is that right?
>
> Rob.

Hi Rob,

You are exactly correct.

Thanks for the help.

Re: PHP Basics

am 10.01.2008 11:58:12 von Rob

On Jan 10, 5:58=A0am, Saravana wrote:
> On Jan 9, 8:05 pm, Rob wrote:
>
>
>
>
>
> > On Jan 9, 10:34 am, Erwin Moller
>
> > wrote:
> > > Saravana wrote:
> > > > Hi all,
>
> > > > I am new to this group and I am new to PHP too.
>
> > > > I want to create a php page with a file browse button and I have to
> > > > add the file path in Mysql table after submit.
>
> > > > Kindly bring me your ideas.
>
> > > Hi,
>
> > > The HTML part for fileuploads is easy (assuming you know HTML)
> > > Google for file upload, follow first link:http://www.cs.tut.fi/~jkorpe=
la/forms/file.html
>
> > > for an introduction.
>
> > > About saving the file path: forget it.
> > > Fileuploads only send the file(s) to the server, NOT the path where th=
ey
> > > reside on the clientmachine.
> > > Even Javascript will not help you with this: It is also crippled on
> > > purpose when it come to real paths and files.
>
> > > Reason?
> > > It is none of the server's business where the original file is on the
> > > client.
>
> > > Regards,
> > > Erwin Moller
>
> > > > Thanks,
> > > > S.SARAVANAKUMAR- Hide quoted text -
>
> > > - Show quoted text -
>
> > Erwin - that's not strictly true.
>
> > JavaScript could be used to store the original location of the file,
> > like this :-
>
> >


> > =A0
> >

>
> > Having said that, I can't think why you would want the original
> > location. I think Saravana is actually asking how to store the name/
> > path of the file on the server, so it can be retreived.
>
> > Is that right?
>
> > Rob.
>
> Hi Rob,
>
> You are exactly correct.
>
> Thanks for the help.- Hide quoted text -
>
> - Show quoted text -

OK, then you need to do this in 3 steps. I'll give you pointers to
what you need to do, but you'll need to write that exact code your
self.

The first step is to present an upload form, fairly simple.

The second step is to process the file upload using PHP. There's an
exacmple of both of these steps at http://uk3.php.net/manual/en/features.fil=
e-upload.php.

Once the file has been uploaded and you have the name and location of
it from the first part of your upload script, then you can write that
into your database using mysql_query() - http://uk3.php.net/manual/en/functi=
on.mysql-query.php

Please have a go at writing the code, but if you get stuck, then come
back to us.

Robert.