Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,


So do I still use move_uploaded_file?



Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.


Got it, thanks!!

-Jason

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:40 PM, Jason Todd Slack-Moehrle
<[EMAIL PROTECTED]> wrote:
> Hi Eric,
>
> 'tempUploads/1425182872.xlsUploaded The File.'
>
> http://us2.php.net/manual/en/function.is-uploaded-file.php
> http://us2.php.net/manual/en/features.file-upload.errors.php
>
> So do I still use move_uploaded_file?
> -Jason

Absolutely.  I just didn't see anywhere in your code where you were
checking for an error with the file upload itself or that it did exist
on the server before moving it.

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi Eric,



'tempUploads/1425182872.xlsUploaded The File.'


http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php


So do I still use move_uploaded_file?

-Jason

Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Eric Butera
On Fri, Dec 5, 2008 at 5:13 PM, Jason Todd Slack-Moehrle
<[EMAIL PROTECTED]> wrote:
> Here is the output I am printing:
>
> 'tempUploads/1425182872.xlsUploaded The File.'
>
> What is the issue?
>
> -Jason
>
>
> On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:
>
>> Hi All,
>>
>> I am uploading a file and it says it worked, but I dont see it in the
>> directory
>>
>> Here is my code so far:
>>
>>$allowed_ext = array('csv','xls');
>>$ext = end(explode('.',$_FILES['uploadedfile']['name']));
>>$ran2 = rand().".";
>>$target = "tempUploads/";
>>$target = $target . $ran2.$ext;
>>
>>if($_FILES['uploadedfile']['size'] > 200){
>>$message = 'File over 2MB';
>>echo $message;
>>exit;
>>}
>>
>>if($message == NULL && !in_array($ext,$allowed_ext)){
>>$message = 'File extension not allowed'.' extension
>> is:'.$ext;
>>echo $message;
>>exit;
>>}
>>
>>if($message == NULL) {
>>if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
>> $target))
>>{
>>$message = "Uploaded The File.";
>>echo $message;
>>
>>// upload was successful, now lets work with it
>>include '_functions.inc'; // Utility Functions
>>
>>include '_fileHeaders.inc'; // CSV File Headers
>> that we expect, in the proper order
>>
>>include '_fileParse.inc'; // CSV File Parsing
>>}
>>else
>>{
>>$message = "Sorry, there was a problem uploading
>> your file.";
>>echo $message;
>>}
>>}
>>
>> How can I verify it is there? I ftp in and I dont see it.
>>
>> -Jason
>>
>>
>> --
>> 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
>
>

Read up!

http://us2.php.net/manual/en/function.is-uploaded-file.php
http://us2.php.net/manual/en/features.file-upload.errors.php

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



Re: [PHP] File Uploads Help!!! --Forgot

2008-12-05 Thread Jason Todd Slack-Moehrle

Here is the output I am printing:

'tempUploads/1425182872.xlsUploaded The File.'

What is the issue?

-Jason


On Dec 5, 2008, at 2:11 PM, Jason Todd Slack-Moehrle wrote:


Hi All,

I am uploading a file and it says it worked, but I dont see it in  
the directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand().".";
$target = "tempUploads/";
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size'] > 200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL && !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = "Uploaded The File.";
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect,  
in the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = "Sorry, there was a problem uploading your 
file.";
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


--
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] File Uploads Help!!!

2008-12-05 Thread Jason Todd Slack-Moehrle

Hi All,

I am uploading a file and it says it worked, but I dont see it in the  
directory


Here is my code so far:

$allowed_ext = array('csv','xls');
$ext = end(explode('.',$_FILES['uploadedfile']['name']));
$ran2 = rand().".";
$target = "tempUploads/";
$target = $target . $ran2.$ext;

if($_FILES['uploadedfile']['size'] > 200){
$message = 'File over 2MB';
echo $message;
exit;
}

if($message == NULL && !in_array($ext,$allowed_ext)){
$message = 'File extension not allowed'.' extension is:'.$ext;
echo $message;
exit;
}

if($message == NULL) {
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], 
$target))
{
$message = "Uploaded The File.";
echo $message;

// upload was successful, now lets work with it
include '_functions.inc'; // Utility Functions

			include '_fileHeaders.inc'; // CSV File Headers that we expect, in  
the proper order


include '_fileParse.inc'; // CSV File Parsing
}
else
{
$message = "Sorry, there was a problem uploading your 
file.";
echo $message;
}
}

How can I verify it is there? I ftp in and I dont see it.

-Jason


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



[PHP] [so O T that it hurts :-)] Re: [PHP] file uploads Q?

2006-12-13 Thread Jochem Maas
tedd wrote:
> At 5:14 PM +0100 12/12/06, Børge Holen wrote:
>> On Tuesday 12 December 2006 15:02, Jochem Maas wrote:
>>  > Børge Holen wrote:
>>>

...

> 
> Well... if Jochem is a moron, then I must be dunce because I've learn a
> lot from him, and continue to do so. If you take the time to listen,
> even you might learn something.

:-) very kind of you - note that the knowledge flows boths ways, I might be
rather far down the php road but from what I gather you were programming rocks
when I was still wearing nappies, many times I find myself learning something 
new
about IT/programming in general from the old skool brigage - something Im very 
grateful
for... let's hope Eight-of-Nine comes around and joins the 'clan'**.

fancy a change? I'll swap my moron badge for your dunce cap and a packet of
peanuts. :-P

also there's a rather nice chap on this list claiming to be the village idiot,
maybe we can convince into a 3 way swap - a change of scene for every kind of
fool? :-)

** replace 'clan' with whatever word synonymous with the concept of 'group'
doesn't offend you (in reference to a post ages ago where someone complained 
about
tedd's use of the word 'gang'.

> 
> tedd
> 
> As Funkadelic once said:
> "Free your mind... and your ass will follow."
> 

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



Re: [PHP] file uploads Q?

2006-12-13 Thread tedd

At 5:14 PM +0100 12/12/06, Børge Holen wrote:

On Tuesday 12 December 2006 15:02, Jochem Maas wrote:
 > Børge Holen wrote:



 > > It is sad to see that you got an amazing tool like this list and still

 > manages to read and understand it the way you FEEL like at any moment.

 what makes this list 'amazing' is the handful of people who regularly
 answer (even the most banal) questions.

 the interpretation is the perogative of the reader - if you feel you are
 being misunderstood your only recourse is to write more clearly, moaning
 about how other people 'feel like reading & understanding' what you write
 is futile and childish.

 AFAIC rather than hiding your derision behind some politically correct
 'sadness' (which you either imply to be some kind of fact and/or an opinion
 shared by some unnamed group - whereas I hazard to guess that neither is
 even close to the truth) just come out and say what *you* mean.


LOL, Yes yes, I agree with a lot of what you are saying, more or less bs.
but then again; you are a complete moron. go relieve yerself, that would
probably help.


Well... if Jochem is a moron, then I must be 
dunce because I've learn a lot from him, and 
continue to do so. If you take the time to 
listen, even you might learn something.


tedd

As Funkadelic once said:
"Free your mind... and your ass will follow."

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 15:02, Jochem Maas wrote:
> Børge Holen wrote:
>
> ...
>
> > It is sad to see that you got an amazing tool like this list and still
> > manages to read and understand it the way you FEEL like at any moment.
>
> what makes this list 'amazing' is the handful of people who regularly
> answer (even the most banal) questions.
>
> the interpretation is the perogative of the reader - if you feel you are
> being misunderstood your only recourse is to write more clearly, moaning
> about how other people 'feel like reading & understanding' what you write
> is futile and childish.
>
> AFAIC rather than hiding your derision behind some politically correct
> 'sadness' (which you either imply to be some kind of fact and/or an opinion
> shared by some unnamed group - whereas I hazard to guess that neither is
> even close to the truth) just come out and say what *you* mean.

LOL, Yes yes, I agree with a lot of what you are saying, more or less bs.
but then again; you are a complete moron. go relieve yerself, that would 
probably help. 

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



Re: [PHP] file uploads Q?

2006-12-12 Thread David Giragosian

On 12/12/06, Jochem Maas <[EMAIL PROTECTED]> wrote:


Stut wrote:
> Jochem Maas wrote:
>> and say what *you* mean.
>
> I LIKE MARMITE!!

you have my condolences.

>
> Damn, that does feel better.

see, just let it out... (said in soothing psychoanalyst's voice)

>
> -Stut
> (fairly bored today)

really!? ;-)

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



And someone wonders why the traffic on this site has slowed to a crawl...?
If I wanted to be misunderstood, I'd talk with my wife.

David


Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Stut wrote:
> Jochem Maas wrote:
>> and say what *you* mean.
> 
> I LIKE MARMITE!!

you have my condolences.

> 
> Damn, that does feel better.

see, just let it out... (said in soothing psychoanalyst's voice)

> 
> -Stut
> (fairly bored today)

really!? ;-)

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Stut

Jochem Maas wrote:

and say what *you* mean.


I LIKE MARMITE!!

Damn, that does feel better.

-Stut
(fairly bored today)

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:

...

> It is sad to see that you got an amazing tool like this list and still 
> manages 
> to read and understand it the way you FEEL like at any moment.
> 

what makes this list 'amazing' is the handful of people who regularly answer
(even the most banal) questions.

the interpretation is the perogative of the reader - if you feel you are
being misunderstood your only recourse is to write more clearly, moaning about
how other people 'feel like reading & understanding' what you write is futile
and childish.

AFAIC rather than hiding your derision behind some politically correct 'sadness'
(which you either imply to be some kind of fact and/or an opinion shared by 
some unnamed
group - whereas I hazard to guess that neither is even close to the truth) just 
come out
and say what *you* mean.

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Stut

Børge Holen wrote:
No, I LEARN from this list. 


you?


I smoke this list. Keeps me happy, out of trouble, and best of all it's 
free!


-Stut

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



RE: [PHP] file uploads Q?

2006-12-12 Thread Tim


> -Message d'origine-
> De : Jochem Maas [mailto:[EMAIL PROTECTED]
> Envoyé : mardi 12 décembre 2006 14:10
> À : Tim
> Cc : php-general@lists.php.net
> Objet : Re: [PHP] file uploads Q?
> 
> Tim wrote:
> >> Børge Holen wrote:
> >>> On Monday 11 December 2006 20:48, Jochem Maas wrote:
> >>>> Richard Lynch wrote:
> >>>>> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> >>>>>> Is it possible to allow  user pick several images and upload them
> all
> >>>>>> at
> >>>>>> once? (I need to pass the images to a function for the resize). Or
> do
> >>>>>> I need
> >>>>>> to give several browse buttons to allow multiple file uploads?
> >>>>> Yes, you would need to have several INPUT TYPE="FILE" browse
> buttons.
> >>>>>
> >>>>>> Also I have seen a application (written with MS tools) that allows
> >>>>>> user to
> >>>>>> upload a zip file containing images and the zip is automatically
> >>>>>> uncompressed to a server disk. Can this be done with PHP also?
> >>>>> Yes.
> >>>>> http://php.net/zip
> >>>> the zip extension is only available in php5.2 (or installable via
> >>>> pecl).
> >>>>
> >>>> another option would to use the exec() function to make a call to
> >>>> gunzip in order to unpack the contents of the zip file.
> >>>>
> >>>> a truely poorman's alternative would be to offer multiple FILE input
> >>>> fields on the relevant page and check which one's are not empty when
> >>>> the submission occurs.
> 
> >>> there is no reason for checking each input.
> 
> >> is that crack your smoking?
> >
> >
> > Well considering you are using multiple FILE input fields, when you post
> the
> > form all file info is stored in $_FILE array.. So weather or not the
> user
> > added a file to the a certain field is irrelevant. For example:
> >
> >  <--- filled
> > 
> >  <--- filled
> >
> > You would then parse this with:
> >
> > for ($i=0; $i >  
> > }
> 
> nice, so basically what your saying is need to check each input.
> if you have three file inputs - regardless of what you call them (using
> the '[]' gives you a nice array structure to loop) you will have to check
> each
> one to see whether it 'contains' a *valid* *uploaded* file (or whether the
> user uploaded nothing in a given input, or whether an error occured with a
> particular file, etc).
> 
> copy/pasting sombody else's file upload handler code doesn't constitute
> 'no reason to check each input' - it's simply handing off the input
> checking
> onto code written by someone else.
> 
Ermm ok, if you say so, thats a standard validation loop i made using info
from php.net, so yes i did copy/paste.. MY code.. 

I never said you don't need to check each file.. 
Isn't it standard to validate each file against certain parameters?
I validate each input as each file uploaded (images) are set to be displayed
in a certain fashion on the main page based on weather it is number 0 (main
image) number >0 are secondary images that require smaller thumbnails.
Secondly my clients want the files displayed in a certain order rather then
randomly getting files from a certain directory. I add the file "position"
($i) in the database for correct display order.

All depends on the context of which you want to display the files later on..

That’s just my way of parsing it there are many others.. Mine works, its
fast, and requires little code rather then bulking my site with costly java
applets.

> >
> > So no I don't think he's on crack mate :)
> 
> either way he's unlikely to be financing said crack habit with the
> proceeds
> of paid php development.

I just made a remark on this, because i believe debate on a certain fashion
of coding is valid on this list, comments like yours which have nothing to
do with coding and are just a personal opinion maybe expressing your
frustration with life are not what I look for on this list. Wasting my time
opening a message with these types of remarks is not what I am looking for
either. Furthermore these kinds of comments degrade the quality of these
lists. And I don't think I am alone in believing this.

Regards,
Tim

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 14:10, Jochem Maas wrote:
> Tim wrote:
> >> Børge Holen wrote:
> >>> On Monday 11 December 2006 20:48, Jochem Maas wrote:
>  Richard Lynch wrote:
> > On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> >> Is it possible to allow  user pick several images and upload them
> >> all at
> >> once? (I need to pass the images to a function for the resize). Or
> >> do I need
> >> to give several browse buttons to allow multiple file uploads?
> >
> > Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> >
> >> Also I have seen a application (written with MS tools) that allows
> >> user to
> >> upload a zip file containing images and the zip is automatically
> >> uncompressed to a server disk. Can this be done with PHP also?
> >
> > Yes.
> > http://php.net/zip
> 
>  the zip extension is only available in php5.2 (or installable via
>  pecl).
> 
>  another option would to use the exec() function to make a call to
>  gunzip in order to unpack the contents of the zip file.
> 
>  a truely poorman's alternative would be to offer multiple FILE input
>  fields on the relevant page and check which one's are not empty when
>  the submission occurs.
> >>>
> >>> there is no reason for checking each input.
> >>
> >> is that crack your smoking?
> >
> > Well considering you are using multiple FILE input fields, when you post
> > the form all file info is stored in $_FILE array.. So weather or not the
> > user added a file to the a certain field is irrelevant. For example:
> >
> >  <--- filled
> > 
> >  <--- filled
> >
> > You would then parse this with:
> >
> > for ($i=0; $i >  
> > }
>
> nice, so basically what your saying is need to check each input.
> if you have three file inputs - regardless of what you call them (using
> the '[]' gives you a nice array structure to loop) you will have to check
> each one to see whether it 'contains' a *valid* *uploaded* file (or whether
> the user uploaded nothing in a given input, or whether an error occured
> with a particular file, etc).
>
> copy/pasting sombody else's file upload handler code doesn't constitute
> 'no reason to check each input' - it's simply handing off the input
> checking onto code written by someone else

It is sad to see that you got an amazing tool like this list and still manages 
to read and understand it the way you FEEL like at any moment.

>
> > So no I don't think he's on crack mate :)
>
> either way he's unlikely to be financing said crack habit with the proceeds
> of paid php development.
>
> >>> Take a look at my earlier questions with the subject "A general UL
> >>
> >> script" and
> >>
> >>> the replies with various ppl here 'bout the use of $_FILES.
> >>> This way it will check anything listed in the file(s) input of form(s).
> >>
> >> er, whatever. whose next?
> >
> > Some people generate large amounts of irrelevant crap traffic for nothing
> > imo :)
>
> I do my best. (there is a gag in there about 'irrelevant crack' but I'll
> let it pass this time).

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:
> On Tuesday 12 December 2006 12:01, you wrote:
>> Børge Holen wrote:
>>> On Monday 11 December 2006 20:48, Jochem Maas wrote:
 Richard Lynch wrote:

...

>> is that crack your smoking?
> 
> No, I LEARN from this list. 
> 
> you?

we'll I'll admit to learning plenty on this list from 'old wise' ones like
the ubiquitous mr Lynch. but as far as your concerned I TEACH on this list.

TEACHER: are you smoking crack?
STUDENT: no, I learn from this list!
TEACHER: what you think you're learning through your crack haze is not
what we are teaching.



STUDENT: f*** ***, (*&^# [EMAIL PROTECTED] #$)Q !)*#%^& [EMAIL PROTECTED] 
@[EMAIL PROTECTED] %&#

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Tim wrote:
>> Børge Holen wrote:
>>> On Monday 11 December 2006 20:48, Jochem Maas wrote:
 Richard Lynch wrote:
> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
>> Is it possible to allow  user pick several images and upload them all
>> at
>> once? (I need to pass the images to a function for the resize). Or do
>> I need
>> to give several browse buttons to allow multiple file uploads?
> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
>
>> Also I have seen a application (written with MS tools) that allows
>> user to
>> upload a zip file containing images and the zip is automatically
>> uncompressed to a server disk. Can this be done with PHP also?
> Yes.
> http://php.net/zip
 the zip extension is only available in php5.2 (or installable via
 pecl).

 another option would to use the exec() function to make a call to
 gunzip in order to unpack the contents of the zip file.

 a truely poorman's alternative would be to offer multiple FILE input
 fields on the relevant page and check which one's are not empty when
 the submission occurs.

>>> there is no reason for checking each input.

>> is that crack your smoking?
> 
> 
> Well considering you are using multiple FILE input fields, when you post the
> form all file info is stored in $_FILE array.. So weather or not the user
> added a file to the a certain field is irrelevant. For example:
> 
>  <--- filled
>  
>  <--- filled
> 
> You would then parse this with:
> 
> for ($i=0; $i  
> }

nice, so basically what your saying is need to check each input.
if you have three file inputs - regardless of what you call them (using
the '[]' gives you a nice array structure to loop) you will have to check each
one to see whether it 'contains' a *valid* *uploaded* file (or whether the
user uploaded nothing in a given input, or whether an error occured with a
particular file, etc).

copy/pasting sombody else's file upload handler code doesn't constitute
'no reason to check each input' - it's simply handing off the input checking
onto code written by someone else.

> 
> So no I don't think he's on crack mate :)

either way he's unlikely to be financing said crack habit with the proceeds
of paid php development.

> 
>>> Take a look at my earlier questions with the subject "A general UL
>> script" and
>>> the replies with various ppl here 'bout the use of $_FILES.
>>> This way it will check anything listed in the file(s) input of form(s).
>> er, whatever. whose next?
>  
> 
> Some people generate large amounts of irrelevant crap traffic for nothing
> imo :)

I do my best. (there is a gag in there about 'irrelevant crack' but I'll let it 
pass
this time).

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Børge Holen
On Tuesday 12 December 2006 12:01, you wrote:
> Børge Holen wrote:
> > On Monday 11 December 2006 20:48, Jochem Maas wrote:
> >> Richard Lynch wrote:
> >>> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
>  Is it possible to allow  user pick several images and upload them all
>  at
>  once? (I need to pass the images to a function for the resize). Or do
>  I need
>  to give several browse buttons to allow multiple file uploads?
> >>>
> >>> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> >>>
>  Also I have seen a application (written with MS tools) that allows
>  user to
>  upload a zip file containing images and the zip is automatically
>  uncompressed to a server disk. Can this be done with PHP also?
> >>>
> >>> Yes.
> >>> http://php.net/zip
> >>
> >> the zip extension is only available in php5.2 (or installable via
> >> pecl).
> >>
> >> another option would to use the exec() function to make a call to
> >> gunzip in order to unpack the contents of the zip file.
> >>
> >> a truely poorman's alternative would be to offer multiple FILE input
> >> fields on the relevant page and check which one's are not empty when
> >> the submission occurs.
> >
> > there is no reason for checking each input.
>
> is that crack your smoking?

No, I LEARN from this list. 

you?



>
> > Take a look at my earlier questions with the subject "A general UL
> > script" and the replies with various ppl here 'bout the use of $_FILES.
> > This way it will check anything listed in the file(s) input of form(s).
>
> er, whatever. whose next?

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



RE: [PHP] file uploads Q?

2006-12-12 Thread Tim

> Børge Holen wrote:
> > On Monday 11 December 2006 20:48, Jochem Maas wrote:
> >> Richard Lynch wrote:
> >>> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
>  Is it possible to allow  user pick several images and upload them all
>  at
>  once? (I need to pass the images to a function for the resize). Or do
>  I need
>  to give several browse buttons to allow multiple file uploads?
> >>> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> >>>
>  Also I have seen a application (written with MS tools) that allows
>  user to
>  upload a zip file containing images and the zip is automatically
>  uncompressed to a server disk. Can this be done with PHP also?
> >>> Yes.
> >>> http://php.net/zip
> >> the zip extension is only available in php5.2 (or installable via
> >> pecl).
> >>
> >> another option would to use the exec() function to make a call to
> >> gunzip in order to unpack the contents of the zip file.
> >>
> >> a truely poorman's alternative would be to offer multiple FILE input
> >> fields on the relevant page and check which one's are not empty when
> >> the submission occurs.
> >
> > there is no reason for checking each input.
> 
> is that crack your smoking?


Well considering you are using multiple FILE input fields, when you post the
form all file info is stored in $_FILE array.. So weather or not the user
added a file to the a certain field is irrelevant. For example:

 <--- filled
 
 <--- filled

You would then parse this with:

for ($i=0; $i
}

count($_FILES['userfile']['name']); would be two here 


if you want to make sure user has uploaded three files then just compare to
the count() value.. otherwise just parse the content..

So no I don't think he's on crack mate :)

> > Take a look at my earlier questions with the subject "A general UL
> script" and
> > the replies with various ppl here 'bout the use of $_FILES.
> > This way it will check anything listed in the file(s) input of form(s).
> 
> er, whatever. whose next?
 

Some people generate large amounts of irrelevant crap traffic for nothing
imo :)

Tim

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



Re: [PHP] file uploads Q?

2006-12-12 Thread Jochem Maas
Børge Holen wrote:
> On Monday 11 December 2006 20:48, Jochem Maas wrote:
>> Richard Lynch wrote:
>>> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
 Is it possible to allow  user pick several images and upload them all
 at
 once? (I need to pass the images to a function for the resize). Or do
 I need
 to give several browse buttons to allow multiple file uploads?
>>> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
>>>
 Also I have seen a application (written with MS tools) that allows
 user to
 upload a zip file containing images and the zip is automatically
 uncompressed to a server disk. Can this be done with PHP also?
>>> Yes.
>>> http://php.net/zip
>> the zip extension is only available in php5.2 (or installable via
>> pecl).
>>
>> another option would to use the exec() function to make a call to
>> gunzip in order to unpack the contents of the zip file.
>>
>> a truely poorman's alternative would be to offer multiple FILE input
>> fields on the relevant page and check which one's are not empty when
>> the submission occurs.
> 
> there is no reason for checking each input.

is that crack your smoking?

> Take a look at my earlier questions with the subject "A general UL script" 
> and 
> the replies with various ppl here 'bout the use of $_FILES.
> This way it will check anything listed in the file(s) input of form(s).

er, whatever. whose next?

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



Re: [PHP] file uploads Q?

2006-12-11 Thread Chris

Jim Lucas wrote:

Jochem Maas wrote:

Richard Lynch wrote:
 

On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
   

Is it possible to allow  user pick several images and upload them all
at
once? (I need to pass the images to a function for the resize). Or do
I need
to give several browse buttons to allow multiple file uploads?
  

Yes, you would need to have several INPUT TYPE="FILE" browse buttons.

   

Also I have seen a application (written with MS tools) that allows
user to
upload a zip file containing images and the zip is automatically
uncompressed to a server disk. Can this be done with PHP also?
  

Yes.
http://php.net/zip



the zip extension is only available in php5.2 (or installable via
pecl).

  
Just to let you know, you can read and unzip with v4.x but it has to be 
compiled in.


So, you would be able to READ a zip archive, but not WRITE one.

PHP 4 >= 4.1.0, and PECL is required


There is also the pear class:

http://pear.php.net/package/File_Archive

No idea about what requirements that has, just another option. :)

--
Postgresql & php tutorials
http://www.designmagick.com/

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



Re: [PHP] file uploads Q?

2006-12-11 Thread Jim Lucas

Jochem Maas wrote:

Richard Lynch wrote:
  

On Sat, December 9, 2006 12:18 pm, William Stokes wrote:


Is it possible to allow  user pick several images and upload them all
at
once? (I need to pass the images to a function for the resize). Or do
I need
to give several browse buttons to allow multiple file uploads?
  

Yes, you would need to have several INPUT TYPE="FILE" browse buttons.



Also I have seen a application (written with MS tools) that allows
user to
upload a zip file containing images and the zip is automatically
uncompressed to a server disk. Can this be done with PHP also?
  

Yes.
http://php.net/zip



the zip extension is only available in php5.2 (or installable via
pecl).

  
Just to let you know, you can read and unzip with v4.x but it has to be 
compiled in.


So, you would be able to READ a zip archive, but not WRITE one.

PHP 4 >= 4.1.0, and PECL is required

another option would to use the exec() function to make a call to
gunzip in order to unpack the contents of the zip file.

a truely poorman's alternative would be to offer multiple FILE input
fields on the relevant page and check which one's are not empty when
the submission occurs.

lastly there are custom (usually java based) browser plugins capable
of providing uploads-on-steriods - obviously there would a purchasing cost
involved and more than likely you will be requried to implement something
server side to complete the functionality.

  

  


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



Re: [PHP] file uploads Q?

2006-12-11 Thread Børge Holen
On Monday 11 December 2006 20:48, Jochem Maas wrote:
> Richard Lynch wrote:
> > On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> >> Is it possible to allow  user pick several images and upload them all
> >> at
> >> once? (I need to pass the images to a function for the resize). Or do
> >> I need
> >> to give several browse buttons to allow multiple file uploads?
> >
> > Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> >
> >> Also I have seen a application (written with MS tools) that allows
> >> user to
> >> upload a zip file containing images and the zip is automatically
> >> uncompressed to a server disk. Can this be done with PHP also?
> >
> > Yes.
> > http://php.net/zip
>
> the zip extension is only available in php5.2 (or installable via
> pecl).
>
> another option would to use the exec() function to make a call to
> gunzip in order to unpack the contents of the zip file.
>
> a truely poorman's alternative would be to offer multiple FILE input
> fields on the relevant page and check which one's are not empty when
> the submission occurs.

there is no reason for checking each input.
Take a look at my earlier questions with the subject "A general UL script" and 
the replies with various ppl here 'bout the use of $_FILES.
This way it will check anything listed in the file(s) input of form(s).

>
> lastly there are custom (usually java based) browser plugins capable
> of providing uploads-on-steriods - obviously there would a purchasing cost
> involved and more than likely you will be requried to implement something
> server side to complete the functionality.

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] file uploads Q?

2006-12-11 Thread Jochem Maas
Richard Lynch wrote:
> On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
>> Is it possible to allow  user pick several images and upload them all
>> at
>> once? (I need to pass the images to a function for the resize). Or do
>> I need
>> to give several browse buttons to allow multiple file uploads?
> 
> Yes, you would need to have several INPUT TYPE="FILE" browse buttons.
> 
>> Also I have seen a application (written with MS tools) that allows
>> user to
>> upload a zip file containing images and the zip is automatically
>> uncompressed to a server disk. Can this be done with PHP also?
> 
> Yes.
> http://php.net/zip

the zip extension is only available in php5.2 (or installable via
pecl).

another option would to use the exec() function to make a call to
gunzip in order to unpack the contents of the zip file.

a truely poorman's alternative would be to offer multiple FILE input
fields on the relevant page and check which one's are not empty when
the submission occurs.

lastly there are custom (usually java based) browser plugins capable
of providing uploads-on-steriods - obviously there would a purchasing cost
involved and more than likely you will be requried to implement something
server side to complete the functionality.

> 

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



Re: [PHP] file uploads Q?

2006-12-09 Thread Richard Lynch
On Sat, December 9, 2006 12:18 pm, William Stokes wrote:
> Is it possible to allow  user pick several images and upload them all
> at
> once? (I need to pass the images to a function for the resize). Or do
> I need
> to give several browse buttons to allow multiple file uploads?

Yes, you would need to have several INPUT TYPE="FILE" browse buttons.

> Also I have seen a application (written with MS tools) that allows
> user to
> upload a zip file containing images and the zip is automatically
> uncompressed to a server disk. Can this be done with PHP also?

Yes.
http://php.net/zip

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] file uploads Q?

2006-12-09 Thread William Stokes
Hello,

I have somehow managed to write a scipt that is able to upload and resize 
images to a server :))) Sad part is that now the user can upload only one 
image at a time.(user has a browse button for browsing images in his local 
disk and can pick only one at a time).

Is it possible to allow  user pick several images and upload them all at 
once? (I need to pass the images to a function for the resize). Or do I need 
to give several browse buttons to allow multiple file uploads?

Also I have seen a application (written with MS tools) that allows user to 
upload a zip file containing images and the zip is automatically 
uncompressed to a server disk. Can this be done with PHP also?

All help and tips appreciated!

Thanks
-Will

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 3:42 pm, Rahul S. Johari wrote:
> Richard, I corrected that mistake in a previous email you must have
> missed.
> I had copied the wrong code in my email to the list. The correct code
> is
> indeed  action="https://www.myurl.com/imsafm2_main.php";>
>
> I'm pretty baffled at this stage. I don't understand why this won't
> work
> over SSL. Over the internet I have found a few more people in my
> situation... their posts in forums gone unanswered. Is there no
> solution for
> this? Are there only a handful who encounter this problem?

I suspect that only a handful *DO* encounter it.

Try using Firefox and see if you get a better idea of what's going
wrong by watching the LiveHTTPHeaders extension output.

Also try a form that does NOT have file upload, but IS POST.
And try a GET form and a form that has no file upload but has the
enctype as if it was file upload.

If you can narrow it down like that, you may find a setting in
httpd.conf for the SSL that is the key.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Rahul S. Johari

Richard, I corrected that mistake in a previous email you must have missed.
I had copied the wrong code in my email to the list. The correct code is
indeed https://www.myurl.com/imsafm2_main.php";>

I'm pretty baffled at this stage. I don't understand why this won't work
over SSL. Over the internet I have found a few more people in my
situation... their posts in forums gone unanswered. Is there no solution for
this? Are there only a handful who encounter this problem?


On 10/5/06 4:25 PM, "Richard Lynch" <[EMAIL PROTECTED]> wrote:

> On Wed, October 4, 2006 3:02 pm, Rahul S. Johari wrote:
>> http://www.myurl.com/imsafm2_main.php";
> 
> If you MOVED everything to the SSL server, then http://www.myurl.com
> ain't the right ACTION anymore.  It's now https://www.myurl.com

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 3:02 pm, Rahul S. Johari wrote:
> http://www.myurl.com/imsafm2_main.php";

If you MOVED everything to the SSL server, then http://www.myurl.com
ain't the right ACTION anymore.  It's now https://www.myurl.com

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari

Sorry, copied wrong code to you. Actually code has https in it:
https://www.myurl.com/imsafm2_main.php";
name="upload_form" enctype="multipart/form-data"



On 10/4/06 4:55 PM, "Andrew Brampton" <[EMAIL PROTECTED]> wrote:

> http://www.myurl.com/imsafm2_main.php";
> name="upload_form" enctype="multipart/form-data">
> 
> 
> might be your error, should that not be https://   ?
> 
> Andrew
> 
> - Original Message -
> From: "Rahul S. Johari" <[EMAIL PROTECTED]>
> To: "Jo ã o C â ndido de Souza Neto" <[EMAIL PROTECTED]>; "PHP"
> 
> Sent: Wednesday, October 04, 2006 9:02 PM
> Subject: Re: [PHP] File Uploads not working over SSL
> 
> 
> 
> Well, the File Manager application itself is pretty extensive... But if
> you're looking for the upload code, here it is (sensitive information
> erased):
> 
> if($upload_file) {
> $db = mysql_connect("localhost","usr","pwd");
> mysql_select_db("db",$db);
> $date = date("m-d-Y, D, H:i");
> $img1_name = str_replace("\'", null,
> $img1_name);
> if(($img1_name=="") || ($img1_size<=10)) {
> ?>
>  language="javascript">alert('error');
>  }
> else {
> 
> $justchecking = "imsafm/$location/$img1_name";
> if (file_exists($justchecking)) {
> echo "$img1_name already exists. Please delete
> the file first, or rename the file before uploading.";
> }
> 
> else {
> $sql = "INSERT INTO file
> (login,filename,descr,size,uppedby,date) VALUES
> ('$location','$img1_name','$desc','$img1_size','$PHP_login','$date')";
> $result = mysql_query($sql) or die("There is a
> problem.");
> copy("$img1", "imsafm/$location/$img1_name") or
> die("Could not do");
> }
> }
> 
> 
> And this is what I have as the  tag for the upload form. The form
> itself is pretty simple & basic, so nothing much to show in it:
> http://www.myurl.com/imsafm2_main.php";
> name="upload_form" enctype="multipart/form-data">
> 
> Thanks.
> 
> On 10/4/06 3:49 PM, "João Cândido de Souza Neto"
> <[EMAIL PROTECTED]> wrote:
> 
>> Please, show us your code.
>> 
>> ""Rahul S. Johari"" <[EMAIL PROTECTED]> escreveu na mensagem
>> news:[EMAIL PROTECTED]
>> Ave,
>> 
>> I have a File Manager application in place for over 2 years now.
>> Everything¹s been working groovy!
>> Until yesterday. Yesterday we purchased and installed an SSL Certificate.
>> And now the uploads are not working anymore! Gets the ³Page cannot be
>> displayed² error. Tried the same application without SSL and it¹s working
>> fine!
>> 
>> What¹s the workaround? How do I get this to work on SSL?
>> Any suggestions?
>> 
>> Rahul S. Johari
>> Supervisor, Internet & Administration
>> Informed Marketing Services Inc.
>> 500 Federal Street, Suite 201
>> Troy NY 12180
>> 
>> Tel: (518) 687-6700 x154
>> Fax: (518) 687-6799
>> Email: [EMAIL PROTECTED]
>> http://www.informed-sources.com
> 
> Rahul S. Johari
> Supervisor, Internet & Administration
> Informed Marketing Services Inc.
> 500 Federal Street, Suite 201
> Troy NY 12180
> 
> Tel: (518) 687-6700 x154
> Fax: (518) 687-6799
> Email: [EMAIL PROTECTED]
> http://www.informed-sources.com
> 

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari

Well, the File Manager application itself is pretty extensive... But if
you're looking for the upload code, here it is (sensitive information
erased):

if($upload_file) {
$db = mysql_connect("localhost","usr","pwd");
mysql_select_db("db",$db);
$date = date("m-d-Y, D, H:i");
$img1_name = str_replace("\'", null,
$img1_name);
if(($img1_name=="") || ($img1_size<=10)) {
?>
alert('error');
$img1_name already exists. Please delete
the file first, or rename the file before uploading.";
}
   
else {
$sql = "INSERT INTO file
(login,filename,descr,size,uppedby,date) VALUES
('$location','$img1_name','$desc','$img1_size','$PHP_login','$date')";
$result = mysql_query($sql) or die("There is a
problem.");
copy("$img1", "imsafm/$location/$img1_name") or
die("Could not do");
}
}


And this is what I have as the  tag for the upload form. The form
itself is pretty simple & basic, so nothing much to show in it:
http://www.myurl.com/imsafm2_main.php";
name="upload_form" enctype="multipart/form-data">

Thanks.

On 10/4/06 3:49 PM, "João Cândido de Souza Neto"
<[EMAIL PROTECTED]> wrote:

> Please, show us your code.
> 
> ""Rahul S. Johari"" <[EMAIL PROTECTED]> escreveu na mensagem
> news:[EMAIL PROTECTED]
> Ave,
> 
> I have a File Manager application in place for over 2 years now.
> Everything¹s been working groovy!
> Until yesterday. Yesterday we purchased and installed an SSL Certificate.
> And now the uploads are not working anymore! Gets the ³Page cannot be
> displayed² error. Tried the same application without SSL and it¹s working
> fine!
> 
> What¹s the workaround? How do I get this to work on SSL?
> Any suggestions?
> 
> Rahul S. Johari
> Supervisor, Internet & Administration
> Informed Marketing Services Inc.
> 500 Federal Street, Suite 201
> Troy NY 12180
> 
> Tel: (518) 687-6700 x154
> Fax: (518) 687-6799
> Email: [EMAIL PROTECTED]
> http://www.informed-sources.com

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] File Uploads not working over SSL

2006-10-04 Thread Jo�o C�ndido de Souza Neto
Please, show us your code.

""Rahul S. Johari"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
Ave,

I have a File Manager application in place for over 2 years now.
Everything¹s been working groovy!
Until yesterday. Yesterday we purchased and installed an SSL Certificate.
And now the uploads are not working anymore! Gets the ³Page cannot be
displayed² error. Tried the same application without SSL and it¹s working
fine!

What¹s the workaround? How do I get this to work on SSL?
Any suggestions?

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



[PHP] File Uploads not working over SSL

2006-10-04 Thread Rahul S. Johari
Ave,

I have a File Manager application in place for over 2 years now.
Everything¹s been working groovy!
Until yesterday. Yesterday we purchased and installed an SSL Certificate.
And now the uploads are not working anymore! Gets the ³Page cannot be
displayed² error. Tried the same application without SSL and it¹s working
fine!

What¹s the workaround? How do I get this to work on SSL?
Any suggestions?

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com



Re: [PHP] file uploads and sizes

2005-05-05 Thread Greg Donald
On 5/5/05, Cima <[EMAIL PROTECTED]> wrote:
> i have the following code that works except when the file i'm trying to
> upload excedes the upload_max _filesize and post_max_size defined in the
> php.ini file.
> what happens when the file is smaller than the max sizes mentioned
> previously, the if (isset .) part of the code is executed yet when the
> file exceeds both max sizes, i just get a blank page.
> what id like is to be able to give the user a message saying the file wasnt
> uploaded because  the file was too big.so, how do i verify the size of the
> file the user is trying to upload? ive already tried
> $_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
> which aparently happens when the file isnt uploaded because of the
> post_max_size.
> 
> any help will be greatly appreciated!!

You need to evaluate each of the possible return values for
$_FILES[ 'archivo' ][ 'error' ]

http://php.net/manual/en/features.file-upload.errors.php


-- 
Greg Donald
Zend Certified Engineer
http://destiney.com/

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



[PHP] file uploads and sizes

2005-05-05 Thread Cima
i have the following code that works except when the file i'm trying to
upload excedes the upload_max _filesize and post_max_size defined in the
php.ini file.
what happens when the file is smaller than the max sizes mentioned
previously, the if (isset .) part of the code is executed yet when the
file exceeds both max sizes, i just get a blank page.
what id like is to be able to give the user a message saying the file wasnt
uploaded because  the file was too big.so, how do i verify the size of the
file the user is trying to upload? ive already tried
$_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
which aparently happens when the file isnt uploaded because of the
post_max_size.

any help will be greatly appreciated!!

thanx.

";
 print "of type {$_FILES['archivo']['type']} that is ";
 print "{$_FILES['archivo']['size']} bytes long.";
 $safe_filename = str_replace('/', '', $_FILES['archivo']['name']);
 $safe_filename = str_replace('..', '', $safe_filename);


$dbh = pg_connect("host=localhost dbname=test user=postgres");
 if (!$dbh)
 {
  echo "cannot open connection to the database";
  exit;
 }

 else {
   chmod($archivo,0777);
  pg_exec($dbh,"BEGIN");
  $sql = "INSERT INTO pic_db (name, picoid) VALUES ";
  $sql .= "('$safe_filename', lo_import('$archivo'))";
  $stat = pg_exec($dbh, $sql);
  pg_exec($dbh,"COMMIT");
  pg_close($dbh);
  echo "The file was saved succesfully.";
}

  unlink($archivo); */
}


?>











[PHP] file uploads and sizes

2005-05-05 Thread Cima
i have the following code that works except when the file i'm trying to
upload excedes the upload_max _filesize and post_max_size defined in the
php.ini file.
what happens when the file is smaller than the max sizes mentioned
previously, the if (isset .) part of the code is executed yet when the
file exceeds both max sizes, i just get a blank page.
what id like is to be able to give the user a message saying the file wasnt
uploaded because  the file was too big.so, how do i verify the size of the
file the user is trying to upload? ive already tried
$_FILES['archivo']['size'], but that doesnt work if the variable isnt set,
which aparently happens when the file isnt uploaded because of the
post_max_size.

any help will be greatly appreciated!!

thanx.

";
 print "of type {$_FILES['archivo']['type']} that is ";
 print "{$_FILES['archivo']['size']} bytes long.";
 $safe_filename = str_replace('/', '', $_FILES['archivo']['name']);
 $safe_filename = str_replace('..', '', $safe_filename);


$dbh = pg_connect("host=localhost dbname=test user=postgres");
 if (!$dbh)
 {
  echo "cannot open connection to the database";
  exit;
 }

 else {
   chmod($archivo,0777);
  pg_exec($dbh,"BEGIN");
  $sql = "INSERT INTO pic_db (name, picoid) VALUES ";
  $sql .= "('$safe_filename', lo_import('$archivo'))";
  $stat = pg_exec($dbh, $sql);
  pg_exec($dbh,"COMMIT");
  pg_close($dbh);
  echo "The file was saved succesfully.";
}

  unlink($archivo); */
}


?>









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



[PHP] file uploads

2005-02-27 Thread pmpa

I believe you must have



Pedro.

-Mensagem original-
De: Jeremy Freedman [mailto:[EMAIL PROTECTED] 
Enviada: sábado, 26 de Fevereiro de 2005 20:54
Para: php-general@lists.php.net
Assunto: [PHP] file uploads

I got the files to upload correctly using http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] file uploads

2005-02-26 Thread Jeremy Freedman
I got the files to upload correctly using 

Re: [PHP] File uploads and handling

2004-10-29 Thread Philip Thompson
[embarrassment]
Thanks all. Of course it was a dumb thing I was doing. I didn't give  
the absolute path when "moving" the uploaded file. I got it to work  
though!
[/embarrassment]

~Philip
On Oct 28, 2004, at 9:40 PM, Robby Russell wrote:
On Thu, 2004-10-28 at 19:04 -0500, Philip Thompson wrote:
On Oct 26, 2004, at 7:06 AM, Jason Wong wrote:
On Tuesday 26 October 2004 03:45, Philip Thompson wrote:
I have a form to upload a file from a user's computer to the  
server. I
want to then modify the file, and then let the user save it back.
However, I am having troubles opening the file. It says it doesn't
exist. Any suggestions?

---
if (is_uploaded_file($_FILES['userfile']['name']))
 $handle = fopen($_FILES['userfile']['name'], "r");
else
 echo $filename . " was not uploaded properly";
---
I know the actual filename shows up...
In the above you are only referencing the *filename* and not the  
actual
uploaded file itself.

but somehow it's not uploading.
Ideas?
Read
  manual > Handling file uploads
to see how it all works.
Yeah, that was not useful at all. That's what I originally looked at.
If anyone has some "code" that shows how to reference the actual file,
then that would be helpful. I have pulled my hair out long enough over
this one.
I did try this, but nothing changed (b/c it's just an array):
if (is_uploaded_file(_FILES['userfile']))
 $handle = fopen($_FILES['userfile'], "r");
Tips would be wonderful. Thanks!
Here is an example:
http://blog.planetargon.com/index.php?/archives/ 
26_Uploading_images_into_PostgreSQL.html

hth,
Robby
--
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File uploads and handling

2004-10-28 Thread Robby Russell
On Thu, 2004-10-28 at 19:04 -0500, Philip Thompson wrote:
> On Oct 26, 2004, at 7:06 AM, Jason Wong wrote:
> 
> > On Tuesday 26 October 2004 03:45, Philip Thompson wrote:
> >
> >> I have a form to upload a file from a user's computer to the server. I
> >> want to then modify the file, and then let the user save it back.
> >> However, I am having troubles opening the file. It says it doesn't
> >> exist. Any suggestions?
> >>
> >> ---
> >> if (is_uploaded_file($_FILES['userfile']['name']))
> >>  $handle = fopen($_FILES['userfile']['name'], "r");
> >> else
> >>  echo $filename . " was not uploaded properly";
> >> ---
> >>
> >> I know the actual filename shows up...
> >
> > In the above you are only referencing the *filename* and not the actual
> > uploaded file itself.
> >
> >> but somehow it's not uploading.
> >> Ideas?
> >
> > Read
> >
> >   manual > Handling file uploads
> >
> > to see how it all works.
> 
> Yeah, that was not useful at all. That's what I originally looked at. 
> If anyone has some "code" that shows how to reference the actual file, 
> then that would be helpful. I have pulled my hair out long enough over 
> this one.
> 
> I did try this, but nothing changed (b/c it's just an array):
> 
> if (is_uploaded_file(_FILES['userfile']))
>  $handle = fopen($_FILES['userfile'], "r");
> 
> Tips would be wonderful. Thanks!

Here is an example:

http://blog.planetargon.com/index.php?/archives/26_Uploading_images_into_PostgreSQL.html

hth,

Robby

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] File uploads and handling

2004-10-28 Thread Greg Donald
On Thu, 28 Oct 2004 19:04:27 -0500, Philip Thompson <[EMAIL PROTECTED]> wrote:
> >   manual > Handling file uploads
> >
> > to see how it all works.
> 
> Yeah, that was not useful at all.

That's how the rest of us learned.  The examples on the page is pretty
clear to me.

> That's what I originally looked at.
> If anyone has some "code" that shows how to reference the actual file,
> then that would be helpful. I have pulled my hair out long enough over
> this one.
> 
> I did try this, but nothing changed (b/c it's just an array):
> 
> if (is_uploaded_file(_FILES['userfile']))
>  $handle = fopen($_FILES['userfile'], "r");

$_FILES['userfile']['name'] is the file.
$_FILES['userfile']['tmp_name'] is the name of the file.
$_FILES['userfile'] is as you stated 'just an array'.

It's all right there in the manual. 
http://php.net/manual/en/features.file-upload.php


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] File uploads and handling

2004-10-28 Thread Philip Thompson
On Oct 26, 2004, at 7:06 AM, Jason Wong wrote:
On Tuesday 26 October 2004 03:45, Philip Thompson wrote:
I have a form to upload a file from a user's computer to the server. I
want to then modify the file, and then let the user save it back.
However, I am having troubles opening the file. It says it doesn't
exist. Any suggestions?
---
if (is_uploaded_file($_FILES['userfile']['name']))
 $handle = fopen($_FILES['userfile']['name'], "r");
else
 echo $filename . " was not uploaded properly";
---
I know the actual filename shows up...
In the above you are only referencing the *filename* and not the actual
uploaded file itself.
but somehow it's not uploading.
Ideas?
Read
  manual > Handling file uploads
to see how it all works.
Yeah, that was not useful at all. That's what I originally looked at. 
If anyone has some "code" that shows how to reference the actual file, 
then that would be helpful. I have pulled my hair out long enough over 
this one.

I did try this, but nothing changed (b/c it's just an array):
if (is_uploaded_file(_FILES['userfile']))
$handle = fopen($_FILES['userfile'], "r");
Tips would be wonderful. Thanks!
~Philip
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File uploads and handling

2004-10-25 Thread Jason Wong
On Tuesday 26 October 2004 03:45, Philip Thompson wrote:

> I have a form to upload a file from a user's computer to the server. I
> want to then modify the file, and then let the user save it back.
> However, I am having troubles opening the file. It says it doesn't
> exist. Any suggestions?
>
> ---
> if (is_uploaded_file($_FILES['userfile']['name']))
>  $handle = fopen($_FILES['userfile']['name'], "r");
> else
>  echo $filename . " was not uploaded properly";
> ---
>
> I know the actual filename shows up... 

In the above you are only referencing the *filename* and not the actual 
uploaded file itself.

> but somehow it's not uploading. 
> Ideas?

Read

  manual > Handling file uploads

to see how it all works.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Quantity is no substitute for quality, but its the only one we've got.
*/

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



[PHP] File uploads and handling

2004-10-25 Thread Philip Thompson
Hi all.
I have a form to upload a file from a user's computer to the server. I 
want to then modify the file, and then let the user save it back. 
However, I am having troubles opening the file. It says it doesn't 
exist. Any suggestions?

---
if (is_uploaded_file($_FILES['userfile']['name']))
$handle = fopen($_FILES['userfile']['name'], "r");
else
echo $filename . " was not uploaded properly";
---
I know the actual filename shows up... but somehow it's not uploading. 
Ideas?

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


Re: [PHP] File Uploads

2003-12-26 Thread Jough Jeaux
Hmm, well, to answer my own question, it looks like
the following will do.  Sorry to make an ass of
myself.  Hope you were all entertained!!



Send this file: 




--- Jough Jeaux <[EMAIL PROTECTED]> wrote:
> Greetings all, I want to allow users to upload
> images
> to an online profile.  Anyone know how to let the
> user
> browse his/her local filesystem from the web page?
> 
> 
> __
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing.
> http://photos.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



[PHP] File Uploads

2003-12-26 Thread Jough Jeaux
Greetings all, I want to allow users to upload images
to an online profile.  Anyone know how to let the user
browse his/her local filesystem from the web page?


__
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/

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



Re: [PHP] file uploads

2003-12-02 Thread Jon Bennett
Hi,

I'm working on a class and when a user submits a form to add a new 
product, I'm calling the addProduct method and within that method I 
call another method of the class 3 times. Once for a thumbnail image, 
once for a preview image and once for the full image, is this 
considered the correct approach ???

function myMethod (){

myOtherFunc("full");
myOtherFunc("preview");
myOtherFunc("thumb);
}

Id that the best way to write it ?? It would appear to only have 1 
method running at any one time, so making them work in succession would 
be the obvious answer:

function myMethod (){

if(myOtherFunc("full")){
if(myOtherFunc("preview")){
if(myOtherFunc("thumb)){
echo "all methods returned true!";
} else {
echo "last method returned false!";
}
} else {
echo "2nd method returned false!";
}
} else {
echo "1st method returned false!";
}
}
Is there not a better way of handling this function chain (for want of 
a better word) ???

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 16:05, Jon Bennett wrote:

Down't worry, it's sorted!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for 
so long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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
--
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: [PHP] file uploads

2003-12-01 Thread Eugene Lee
On Mon, Dec 01, 2003 at 02:00:34PM +, Jon Bennett wrote:
: 
: Hi Chris,
: 
: I think you're referring to this:
: 
: $_FILES["image"]["tmp_name"]
: 
: In my class I pass this as a reference:
: 
: $aArgs['Image'] = $_FILES["image"];
: 
: Then, $aImage in my storeBigImage() method is passed the 
: $aArgs['Image'] when it's called:
: 
: $this->storeBigImage($productID, $aArgs['Image']);
: 
: All the image details are there because otherwise functions like 
: getimagesize would fail, it just won't save the resized or, if the 
: dimensions of the uploaded image aren't bigger than my max width and 
: height, original image, and I really have no idea why!!

In your storeBigImage() method, what do you get if you do:

print_r($aArgs);

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



Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Down't worry, it's sorted!

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
sorry, made a mistake when writing my email:

return = $aNewImage['new_name'];

should be:

return $aNewImage['new_name'];

Cheers,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:57, Jon Bennett wrote:

I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
I'm trying to return a value if the file uploads correctly, using 
return, but I don't seem to be getting anything back.

I've added this to my storeImages method

return = $aNewImage['new_name'];

and when I call the method from my addProduct() method I use this:

$sThumbnailFileName = $this->_storeImages($iProductId,  
$aArgs["Image"], 'thumb');

I then assumed I'd be able to just reference the $sThumbnailFileName 
var so I can insert the filename into the db, but it always goes in 
blank, does $sThumbnailFileName not get returned 
$aNewImage['new_name'], or is it stuck in an array or something ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:26, Jon Bennett wrote:

well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, 
where You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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: [PHP] file uploads

2003-12-01 Thread Jon Bennett
well I'll be dammed, that was it! Geeze, you look at something for so 
long sometimes you can't see the wood for the trees

I feel so stoopid now!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 15:10, Pavel Jartsev wrote:

Jon Bennett wrote:
Just to clarify about using move_uploaded_file()
...
function addProduct(){
// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}
...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' .  
$aNewImage['new_name'];
 ...


Just noticed one thing... maybe it's just a typo, but directory, where 
You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

--
Pavel a.k.a. Papi
--
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: [PHP] file uploads

2003-12-01 Thread Pavel Jartsev
Jon Bennett wrote:
Just to clarify about using move_uploaded_file()

...

function addProduct(){

// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}

...

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
...


Just noticed one thing... maybe it's just a typo, but directory, where 
You save uploaded image isn't the same in those examples.

In "move_uploaded_file()" it contains "_img/...", but in 
"storeBigImage()" there is "_lib/...". And therefore first case is 
working and second isn't.

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


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Ok, I've got it sorted now, but I'm buggered as to why this didn't work 
the way I hoped. It seems that if I use an indexed or associative array 
to store the location and new image file name, imagejpeg never works, 
but if I use a normal var it does !! what's with that!

// doesn't work
$aNewImage['image_loc'] = $aNewImage['image_dir'] . 
$aNewImage['new_name'];

// does work!!
$sImageLoc = '/Library/Webserver/Documents/wrox_site/_img/_products/' . 
$aNewImage['new_name'];

Why oh why is that the case ??? Would love to know.

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 14:00, Jon Bennett wrote:

Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

--
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: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Hi Chris,

I think you're referring to this:

$_FILES["image"]["tmp_name"]

In my class I pass this as a reference:

$aArgs['Image'] = $_FILES["image"];

Then, $aImage in my storeBigImage() method is passed the 
$aArgs['Image'] when it's called:

$this->storeBigImage($productID, $aArgs['Image']);

All the image details are there because otherwise functions like 
getimagesize would fail, it just won't save the resized or, if the 
dimensions of the uploaded image aren't bigger than my max width and 
height, original image, and I really have no idea why!!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/


On 1 Dec 2003, at 13:36, Chris Hayes wrote:

PHP first gives the file a temporary name on a temporary location. 
This name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

--
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: [PHP] file uploads

2003-12-01 Thread Chris Hayes
PHP first gives the file a temporary name on a temporary location. This 
name is not the same as the name given in the upload form.
I think the temp filename is in the $_FILES array too, do a 
print_r($_FILES) to check.


Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know it's 
not the permissions, could someone have a little look  at my method and 
let me know if there's anything wrong with it please

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


Re: [PHP] file uploads

2003-12-01 Thread Jon Bennett
Just to clarify about using move_uploaded_file()

I call the storeBigImage methid from aother method like so

function addProduct(){

	$this->storeBigImage($ID, $_FILES["image"]);

}

that doesn't work, if I use this:

function addProduct(){

	// Move the uploaded file to the correct location
 move_uploaded_file($$_FILES["image"]["tmp_name"], 
BASE_DIR."/_img/_products/".$iProductId."_".$fileName);
}

The above works fine, which I find very strange indeed!

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
On 1 Dec 2003, at 12:50, Jon Bennett wrote:

Hi,

I have a file upload problem, but I don't think it's a permission 
thing (if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know 
it's not the permissions, could someone have a little look  at my 
method and let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], 
$aNewImage['width'], $aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);

} else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
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] file uploads

2003-12-01 Thread Jon Bennett
Hi,

I have a file upload problem, but I don't think it's a permission thing 
(if only, that would be simple!).

I have written a resizing method for a class I'm working on, and it 
always fails on the imageJpeg() at the end of the method. This is the 
error I get...

imagejpeg(): Unable to open 
'/Library/WebServer/Documents/my_site/_lib/_products/2_big_me.jpg' for 
writing in 
/Library/WebServer/Documents/my_site/_lib/_classes/class.products.php 
on line 132

Now, here's the strange bit, if I call my method and just use 
move_uploaded_file() then the image is saved correctly, so  I know it's 
not the permissions, could someone have a little look  at my method and 
let me know if there's anything wrong with it please

// $ID is an integer used for naming purposes
// $aImage is an array, it's basically a copy of $_FILES["image"]
// BASE_DIR is a constant var and holds, yep you guessed it, the base 
dir of the site!
// IMGMAXHEIGHT & IMGMAXWIDTH are also constants used for resizing 
purposes

function storeBigImage($ID, $aImage){

// create filenames
fopen($aImage['name'], 'r');
$aNewImage['real_name'] = $aImage['name'];
$aNewImage['new_name'] = $ID . '_' . 'big' . '_' . 
$aNewImage['real_name'];
$aNewImage['image_loc'] = BASE_DIR . '_lib/_products/' 
.  $aNewImage['new_name'];
 
// copy original image
$aNewImage['original_image'] = 
ImageCreateFromJpeg($aImage['tmp_name']);
$aNewImage['sizes'] = getimagesize($aImage['tmp_name']);
$aNewImage['width'] = $aNewImage['sizes'][0];
$aNewImage['height'] = $aNewImage['sizes'][0];

if($aNewImage['width'] >= IMGMAXWIDTH || $aNewImage['height'] 
>= IMGMAXHEIGHT){

// calculate ratios
$iRatio_w = IMGMAXWIDTH / $aNewImage['width'];
$iRatio_h = IMGMAXHEIGHT / $aNewImage['height'];
$iRatio = $iRatio_w < $iRatio_h ? $iRatio_w:$iRatio_h;

// calculate new dimensions
$aNewImage['new_width'] = $aNewImage['width'] * $iRatio;
$aNewImage['new_height'] = $aNewImage['height'] * $iRatio;

// save resized image
$aNewImage['new_image'] = 
ImageCreateTrueColor($aNewImage['new_width'], 
$aNewImage['new_height']);
ImageCopyResized($aNewImage['new_image'], 
ImageCreateFromJpeg($aImage['tmp_name']), 0, 0, 0, 0, 
$aNewImage['new_width'], $aNewImage['new_height'], $aNewImage['width'], 
$aNewImage['height']);
//ImageJpeg($aNewImage['new_image'], 
$aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);

} else {

// save original image
//ImageJpeg($aImage['tmp_name'], $aNewImage['image_loc']);
ImageJpeg($aNewImage['original_image'], 
$aNewImage['image_loc']);
//ImageJpeg($this->aArgs['Image']['tmp_name'], 
$aNewImage['image_loc']);
}
}

I have ftp'd into my local server and the folder in question is set at 
777, and like I said it works fine if I don't use this class

Any ideas ??

Thanks,

Jon

jon bennett  |  [EMAIL PROTECTED]
new media designer / developer
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
J   b   e   n   .   n   e   t

91 Gloucester Rd,  Trowbridge,  Wilts,  BA14 0AD
t: +44 (0) 1225 341039 w: http://www.jben.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: Re[2]: [PHP] File Uploads!

2003-06-30 Thread Jason Wong
On Monday 30 June 2003 07:06, Catalin Trifu wrote:

> I used MAX_FILE_SIZE too in the form which
> uploads the file (the input field is before the file field)
> and I am using IE6 for testing and still the file pass through to
> the server.

> > *IF* the browser supports it then IT would stop the upload of files
> > larger than MAX_FILE_SIZE.

It would only work IF the browser supported it. The fact that it didn't work 
(ie didn't prevent the upload) would suggest that IE doesn't support it?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
zeal, n.:
Quality seen in new graduates -- if you're quick.
*/


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



Re[4]: [PHP] File Uploads!

2003-06-29 Thread Tom Rogers
Hi,

Monday, June 30, 2003, 4:14:02 AM, you wrote:
JW> On Sunday 29 June 2003 20:40, Tom Rogers wrote:

>> Maybe you have to wind up the post_max_size in php.ini and then control
>> with MAX_FILE_SIZE in the form for the error to show up in the $_FILES
>> array

JW> "MAX_FILE_SIZE in the form" is client-side, for the benefit of the browser. 
JW> *IF* the browser supports it then IT would stop the upload of files larger 
JW> than MAX_FILE_SIZE.

JW> -- 
Jason Wong ->> Gremlins Associates -> www.gremlins.biz
JW> Open Source Software Systems Integrators
JW> * Web Design & Hosting * Internet & Intranet Applications Development *
JW> --
JW> Search the list archives before you post
JW> http://marc.theaimsgroup.com/?l=php-general
JW> --
JW> /*
JW> The early bird gets the coffee left over from the night before.
JW> */

php also checks for MAX_FILE_SIZE as you can see in rfc1867.c


while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff) 
TSRMLS_CC)))
{
if (total_bytes > PG(upload_max_filesize)) {
sapi_module.sapi_error(E_WARNING, "upload_max_filesize of %ld bytes 
exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
cancel_upload = UPLOAD_ERROR_A;
} else if (max_file_size && (total_bytes > max_file_size)) {
sapi_module.sapi_error(E_WARNING, "MAX_FILE_SIZE of %ld bytes exceeded 
- file [%s=%s] not saved", max_file_size, param, filename);
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
wlen = fwrite(buff, 1, blen, fp);

if (wlen < blen) {
sapi_module.sapi_error(E_WARNING, "Only %d bytes were written, 
expected to write %ld", wlen, blen);
cancel_upload = UPLOAD_ERROR_C;
} else {
total_bytes += wlen;
}
} 
}

So I set max post to something huge then control it on a form by form
basis,, which seems to work fine and fills in the error bit for me if
it is too big

-- 
regards,
Tom


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



Re: Re[2]: [PHP] File Uploads!

2003-06-29 Thread Catalin Trifu
Hi,

I used MAX_FILE_SIZE too in the form which
uploads the file (the input field is before the file field)
and I am using IE6 for testing and still the file pass through to
the server.

Cheers,
Catalin


"Jason Wong" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Sunday 29 June 2003 20:40, Tom Rogers wrote:
>
> > Maybe you have to wind up the post_max_size in php.ini and then control
> > with MAX_FILE_SIZE in the form for the error to show up in the $_FILES
> > array
>
> "MAX_FILE_SIZE in the form" is client-side, for the benefit of the
browser.
> *IF* the browser supports it then IT would stop the upload of files larger
> than MAX_FILE_SIZE.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> The early bird gets the coffee left over from the night before.
> */
>



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



Re: Re[2]: [PHP] File Uploads!

2003-06-29 Thread Jason Wong
On Sunday 29 June 2003 20:40, Tom Rogers wrote:

> Maybe you have to wind up the post_max_size in php.ini and then control
> with MAX_FILE_SIZE in the form for the error to show up in the $_FILES
> array

"MAX_FILE_SIZE in the form" is client-side, for the benefit of the browser. 
*IF* the browser supports it then IT would stop the upload of files larger 
than MAX_FILE_SIZE.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
The early bird gets the coffee left over from the night before.
*/


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



Re: [PHP] File Uploads!

2003-06-29 Thread Catalin Trifu
Hi,

I already tried $_FILES['userfile']['error'], but
as I already said the $_FILES is empty, completely empty

Cheers,
Catalin


"Tom Rogers" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> Sunday, June 29, 2003, 9:49:43 PM, you wrote:
> CT> Hi,
>
> CT> This is the error I get in the log file:
> CT> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds
the
> CT> limit of 8388608 bytes in Unknown on line 0
>
> CT> This is absolutely correct. The problem is
> CT> this error does not reach my PHP script and I
> CT> have no idea how can I tell my user he posted
> CT> a file which exceds the size.
> CT> The $_FILES is empty, same for $HTTP_...
> CT> Any idea is appreciated.
>
> CT> Cheers,
> CT> Catalin
>
>
> check out
>
> $_FILES['userfile']['error'] it should give some clues
>
>
> UPLOAD_ERR_OK
> Value: 0; There is no error, the file uploaded with success.
>
> UPLOAD_ERR_INI_SIZE
> Value: 1; The uploaded file exceeds the upload_max_filesize directive in
php.ini.
>
> UPLOAD_ERR_FORM_SIZE
> Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was
specified in the html form.
>
> UPLOAD_ERR_PARTIAL
> Value: 3; The uploaded file was only partially uploaded.
>
> UPLOAD_ERR_NO_FILE
> Value: 4; No file was uploaded
>
>
> --
> regards,
> Tom
>



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



Re[2]: [PHP] File Uploads!

2003-06-29 Thread Tom Rogers
Hi,

Sunday, June 29, 2003, 10:17:43 PM, you wrote:
TR> Hi,

TR> Sunday, June 29, 2003, 9:49:43 PM, you wrote:
CT>> Hi,

CT>> This is the error I get in the log file:
CT>> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
CT>> limit of 8388608 bytes in Unknown on line 0

CT>> This is absolutely correct. The problem is
CT>> this error does not reach my PHP script and I
CT>> have no idea how can I tell my user he posted
CT>> a file which exceds the size.
CT>> The $_FILES is empty, same for $HTTP_...
CT>> Any idea is appreciated.

CT>> Cheers,
CT>> Catalin

Maybe you have to wind up the post_max_size in php.ini and then control with
MAX_FILE_SIZE in the form for the error to show up in the $_FILES
array



-- 
regards,
Tom


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



Re: [PHP] File Uploads!

2003-06-29 Thread Tom Rogers
Hi,

Sunday, June 29, 2003, 9:49:43 PM, you wrote:
CT> Hi,

CT> This is the error I get in the log file:
CT> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
CT> limit of 8388608 bytes in Unknown on line 0

CT> This is absolutely correct. The problem is
CT> this error does not reach my PHP script and I
CT> have no idea how can I tell my user he posted
CT> a file which exceds the size.
CT> The $_FILES is empty, same for $HTTP_...
CT> Any idea is appreciated.

CT> Cheers,
CT> Catalin


check out

$_FILES['userfile']['error'] it should give some clues


UPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success. 

UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini. 

UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in 
the html form. 

UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded. 

UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded


-- 
regards,
Tom


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



[PHP] File Uploads!

2003-06-29 Thread Catalin Trifu
Hi,

This is the error I get in the log file:
[error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
limit of 8388608 bytes in Unknown on line 0

This is absolutely correct. The problem is
this error does not reach my PHP script and I
have no idea how can I tell my user he posted
a file which exceds the size.
The $_FILES is empty, same for $HTTP_...
Any idea is appreciated.

Cheers,
Catalin



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



Re: [PHP] File uploads...

2003-03-24 Thread Kevin Stone
- Original Message -
From: "Al" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, March 24, 2003 1:14 PM
Subject: [PHP] File uploads...


> Trying to do what should be rather simple and I have done before.
> Maybe I am just overlooking the obvious but this is the error I get...
>
> Warning: Unable to open 'Array' for reading: No such file or directory
> in /var/www/html/nepso_noah/NEPSO/includes/reporters/update_profile.inc
> on line 33
>
> This 'Array' is just the value of the name from the form field for the
> file upload...
> Here are the pieces of the form that seem to matter...
>
>  action=\"$PHP_SELF?action=update_profile\"
> enctype=\"multipart/form-data\">
>
> 
> 
>
> Now when I call to the submitted data
>
> copy($photonew, "images/reporters/$user_id/$photonew_name");
>
> And for error checking I echo the following
>
> $photonew -- This results as Array <-- though this should be the tmp
path???
> $photonew_name -- This gives me the file name
> etc...
//snip//
> Thanks
> --Al

The uploaded file's path is stored in $_FILES['photonew']['tmp_name'];  You
could extract($_FILES['photonew']) for convenience sake and access with
$tmp_name;
- Kevin



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



RE: [PHP] File uploads...

2003-03-24 Thread Dan Rossi
u etetr reference them with $_FILES['photonew']['tmp_name']

or do a print_r($_FILES); and it'll tell u info in the upload

-Original Message-
From: Al [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 25, 2003 7:14 AM
To: [EMAIL PROTECTED]
Subject: [PHP] File uploads...


Trying to do what should be rather simple and I have done before.
Maybe I am just overlooking the obvious but this is the error I get...

Warning: Unable to open 'Array' for reading: No such file or directory
in /var/www/html/nepso_noah/NEPSO/includes/reporters/update_profile.inc
on line 33

This 'Array' is just the value of the name from the form field for the
file upload...
Here are the pieces of the form that seem to matter...






Now when I call to the submitted data

copy($photonew, "images/reporters/$user_id/$photonew_name");

And for error checking I echo the following

$photonew -- This results as Array <-- though this should be the tmp path???
$photonew_name -- This gives me the file name
etc...

I looked over previous scripts used and they appear to work on other
machines just not this one.

The php.ini is as follows for the file upload area...


; File Uploads ;


; Whether to allow HTTP file uploads.
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default
if not
; specified).
upload_tmp_dir = /tmp

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M

Any ideas what settings I need to change to make this simple process happen?

Thanks
--Al


--
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] File uploads...

2003-03-24 Thread Al
Trying to do what should be rather simple and I have done before.
Maybe I am just overlooking the obvious but this is the error I get...
Warning: Unable to open 'Array' for reading: No such file or directory 
in /var/www/html/nepso_noah/NEPSO/includes/reporters/update_profile.inc 
on line 33

This 'Array' is just the value of the name from the form field for the 
file upload...
Here are the pieces of the form that seem to matter...





Now when I call to the submitted data

copy($photonew, "images/reporters/$user_id/$photonew_name");

And for error checking I echo the following

$photonew -- This results as Array <-- though this should be the tmp path???
$photonew_name -- This gives me the file name
etc...
I looked over previous scripts used and they appear to work on other 
machines just not this one.

The php.ini is as follows for the file upload area...


; File Uploads ;

; Whether to allow HTTP file uploads.
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default 
if not
; specified).
upload_tmp_dir = /tmp

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
Any ideas what settings I need to change to make this simple process happen?

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


Re: [PHP] file uploads

2003-03-04 Thread Joseph Bannon
> They do, and I believe it's until the end of the
> currently-running PHP script.

Perfect! Thanks.

Joseph



__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



Re: [PHP] file uploads

2003-03-04 Thread Liam Gibbs
> 1) Do the temp files automatically delete, or do I
> need to put something in the code to delete them?

They do, and I believe it's until the end of the currently-running PHP
script.


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



Re: [PHP] file uploads

2003-03-04 Thread Chris Hewitt
Ernest E Vogelsinger wrote:

At 19:55 04.03.2003, Joseph Bannon spoke out and said:
[snip]
Regarding file uploads...

1) Do the temp files automatically delete, or do I
need to put something in the code to delete them?
2) If automatically, how long? Where can I set the
length of time until they are deleted?
3) If not, is there a place I can make it be
automatic?
[snip] 

As far as I know (not 100% sure, though...):

1) yes, they do; no, you don't
2) they're deleted by move_uploaded_file(), or when your script exits
3) n/a
The RFC indicates that the http protocol will ensure the temporary file 
is deleted at the end of the request. The fine manual answersd these 
specific questions.

HTH
Chris



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


Re: [PHP] file uploads

2003-03-04 Thread Ernest E Vogelsinger
At 19:55 04.03.2003, Joseph Bannon spoke out and said:
[snip]
>Regarding file uploads...
>
>1) Do the temp files automatically delete, or do I
>need to put something in the code to delete them?
>
>2) If automatically, how long? Where can I set the
>length of time until they are deleted?
>
>3) If not, is there a place I can make it be
>automatic?
[snip] 

As far as I know (not 100% sure, though...):

1) yes, they do; no, you don't
2) they're deleted by move_uploaded_file(), or when your script exits
3) n/a


-- 
   >O Ernest E. Vogelsinger 
   (\) ICQ #13394035 
^ http://www.vogelsinger.at/


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



[PHP] file uploads

2003-03-04 Thread Joseph Bannon
Regarding file uploads...

1) Do the temp files automatically delete, or do I
need to put something in the code to delete them?

2) If automatically, how long? Where can I set the
length of time until they are deleted?

3) If not, is there a place I can make it be
automatic?


Thanks
Joseph

__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

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



[PHP] file uploads received, but mangled

2003-01-21 Thread af
Hi all.

2nd try -- Is the following possible to work around, or is it a bug that I should be 
reporting?

I'm having issues uploading files whose names don't necessarily end with the correct 
extension, in particular text files which don't end in .txt.  (Why they don't is 
complicated, and it's impractical to insist that they must.)  The files are received, 
but altered -- they are prepended with binary data which makes them difficult to deal 
with in an elegant automated way.

No doubt this is a mime type issue, as the files are received as type 
"application/x-macbinary" when sent from OSX Explorer.  Is there any way to force 
plain text, or raw data?  All I want to happen is for the files to be uploaded 
completely unchanged.

Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on 
OpenBSD.

Thanks,
Alex
[EMAIL PROTECTED]

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




[PHP] file uploads received, but mangled

2003-01-20 Thread af
Hi all.

I'm having issues uploading files whose names don't necessarily end with the correct 
extension, in particular text files which don't end in .txt.  (Why they don't is 
complicated, and it's impractical to insist that they must.)  The files are received, 
but altered -- they are prepended with binary data which makes them difficult to deal 
with in an elegant automated way.

No doubt this is a mime type issue, as the files are received as type 
"application/x-macbinary" when sent from OSX Explorer.  Is there any way to force 
plain text, or raw data?  All I want to happen is for the files to be uploaded 
completely unchanged.

Btw, this happens with PHP 4.2.3 on OSX (entropy.ch), and with the latest 4.3 on 
OpenBSD.

Thanks,
Alex
[EMAIL PROTECTED]

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




[PHP] file uploads >800K with php into a BLOB field

2002-12-30 Thread Mike Brancato
i'm having trouble with using php to upload files to be used as resources over 
the web via php and a backend db.  i don't prefer to store them on the 
filesystem, but i guess thats an ultimate solution.  either way, my code works, 
in theory, and literally.  but not on file above 799KB.  why?  got me.  I 
removed the php upload limit to 2GB.  how about mysql?  or maybe internet 
explorer is the one having trouble.  seems IE is getting impatient with files 
over 2MB, it never comes back to the page it POSTs to, just gives that generic 
error screen. my code follows...

set_time_limit(20*60);
  
$filehandle = fopen( $_FILES['thefile']['tmp_name'],  "rb");
$filedata = fread($filehandle, filesize($_FILES['thefile']['tmp_name']));
$filedata = addslashes($filedata);
$name = $_FILES['thefile']['name'];
$size = filesize($_FILES['thefile']['tmp_name']);
$mime = $_FILES['thefile']['type'];
$desc = $_POST['desc'];
print  "Uploaded: $nameFile Size: $size";
$query =  "INSERT INTO `resources` (`name`,`mime`,`size`,`desc`,`file`) values
('$name','$mime','$size','$desc','$filedata');";
if(!$result = mysql_query($query)) {
 print 'Query to database failed.';
 $myerr=mysql_error();
 print  "$myerr  ";
}


--
Mike Brancato

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




Re: [PHP] file uploads double in size - help!

2002-12-28 Thread Michael J. Pawlowsky
This might help you...

http://www.phpbuilder.com/columns/florian19991014.php3?page=4




*** REPLY SEPARATOR  ***

On 28/12/2002 at 2:00 PM [EMAIL PROTECTED] wrote:

>I am having trouble with php file uploads where the files are arriving
>corrupted and information in the file is repeated.  Perhaps some can help
>point me in the right direction.
>
>A very small text file will work fine.  Anything larger than about 2000k
>and
>strange things happen.  In the case of a text file, after about 1100
>characters, the uploaded file will repeat the text starting not from the
>begining of the file but from about midway through and do this back and
>forth for the length of the file, causing the file to double in size.  The
>same problem happens with every file type that I've tried, .jpg, .png,
>.doc,
>.dwg.  It also happens with all php applications that run on the server,
>not
>just one particular piece of software, so it has to be some configuration
>with the server, but I don't know where to look.
>
>It could be something really simple as I'm just getting started.  Anything
>recomendations on things to check that might point me in the right
>direction
>would be greatly appreciated.
>
>Derek
>please reply to [EMAIL PROTECTED]
>
>
>
>--
>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] file uploads double in size - help!

2002-12-28 Thread dgulbranson
I am having trouble with php file uploads where the files are arriving
corrupted and information in the file is repeated.  Perhaps some can help
point me in the right direction.

A very small text file will work fine.  Anything larger than about 2000k and
strange things happen.  In the case of a text file, after about 1100
characters, the uploaded file will repeat the text starting not from the
begining of the file but from about midway through and do this back and
forth for the length of the file, causing the file to double in size.  The
same problem happens with every file type that I've tried, .jpg, .png, .doc,
.dwg.  It also happens with all php applications that run on the server, not
just one particular piece of software, so it has to be some configuration
with the server, but I don't know where to look.

It could be something really simple as I'm just getting started.  Anything
recomendations on things to check that might point me in the right direction
would be greatly appreciated.

Derek
please reply to [EMAIL PROTECTED]



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




[PHP] File uploads...

2002-11-25 Thread David Russell
Hi all,

I am updating a site accounting for register_globals = off. I have a
page which allows for the uploading of a number of files. The page sends
these in an "array" of files.

The destination script used to have:

  if ($AttachmentCount > 0) {
foreach($userfile as $key => $value) {
  AddAttachment($BPFNo, $value, $userfile_name[$key],
$userfile_size[$key], $userfile_type[$key]);
}
  }

Where attachmentcount was a variable which could be 0 (no uploads) or
more (counting the number of $userfile[] variables there should be.
AddAttachment is a function that actually saves the attachment into a
database.

How would I re-do this?

What I would preferably do is have the script AddAttachment for each
$_FILES[] there might be. If I need to change it from an array type
($userfile[]) in the calling script, I can easily do this.

Can someone help me?

Thanks


David Russell
IT Support Manager
Barloworld Optimus (Pty) Ltd
Tel: +2711 444-7250 
Fax: +2711 444-7256
e-mail: [EMAIL PROTECTED]
web: www.BarloworldOptimus.com



smime.p7s
Description: application/pkcs7-signature


RE: [PHP] File Uploads

2002-11-21 Thread John W. Holmes
> I just wanted to know if there was a way to control the owner of the
new
> file because when iupload files the owner is set to httpd which means
that
> I
> can't access the file properly.

Not much you can do about it, if PHP is running as a module. If it's
CGI, then I think you can set it up so the file is owned by you when you
run the scripts.

---John Holmes...



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




[PHP] File Uploads

2002-11-21 Thread James \\Cook
I have created a php file to handle file uploads.

It very simple without any bells or whistles.

I just wanted to know if there was a way to control the owner of the new
file because when iupload files the owner is set to httpd which means that I
can't access the file properly.

My code is as follows.




File Uploads






Cook's File Upload page, please do not use

";
   }
  /* ...or... */
  $move = move_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'], $addr
. $HTTP_POST_FILES['userfile']['name']);
  if (!$move){
   echo ("File Move failed");
   echo ("Try Again");
   }
  else{
   echo("File Moved successfully");
   }
  }
 else{
  echo ("Incorrect pass, sorry");
  echo ("Try Again");
  }
 }

function displayform(){
global $PHP_SELF;
$HTML=<<



 Send this file: 
 


 
 Use this pass: 
 


 Save to this location: 
 


 Default is /home/cj923/public_html/wat/





HTML;
echo ($HTML);
}
?>





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




Re: Re: Re: [PHP] file uploads problem

2002-09-24 Thread Jaski

Thanks Edwin .. this one was Bang On. It was exactly what you said 
.. and now it works .. thanks a lot.

Jaski

On Tue, 24 Sep 2002 @ Edwin wrote :
>Jaski,
>
>On Tuesday, September 24, 2002 5:07 PM
>Jaski wrote:
> > No Edwin .. I can't do any thing to that file .. not even from 
>my
> > ftp client .. can't download can't change permissions ..
> >
>
>I think you won't be able to do anything with the file IF you use 
>your ftp
>client. The reason is because *you* don't own the file so you 
>can't read it
>nor change it's permissions. Your *script(s)* owns the file so 
>most probably
>if you use another script to read and change the permissions, the 
>script
>would be able to do it. In other words, use your php script to 
>read and
>change the permissions. Perhaps, you'd like to play with these 
>functions and
>see what's happening...
>
>   http://www.php.net/manual/en/function.is-readable.php
>   http://www.php.net/manual/en/function.fileperms.php
>   http://www.php.net/manual/en/function.chown.php
>
>Of course, there's a lot more others under
>
>   http://www.php.net/manual/en/ref.filesystem.php
>
>HTH,
>
>- E


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




Re: Re: [PHP] file uploads problem

2002-09-24 Thread @ Edwin
Oops, what I wanted to post was

  http://www.php.net/manual/en/function.chmod.php

and not

  http://www.php.net/manual/en/function.chown.php

- E

On Tuesday, September 24, 2002 6:00 PM
@ Edwin wrote:

> Jaski,
>
> On Tuesday, September 24, 2002 5:07 PM
> Jaski wrote:
> > No Edwin .. I can't do any thing to that file .. not even from my
> > ftp client .. can't download can't change permissions ..
> >
>
> I think you won't be able to do anything with the file IF you use your ftp
> client. The reason is because *you* don't own the file so you can't read
it
> nor change it's permissions. Your *script(s)* owns the file so most
probably
> if you use another script to read and change the permissions, the script
> would be able to do it. In other words, use your php script to read and
> change the permissions. Perhaps, you'd like to play with these functions
and
> see what's happening...
>
>   http://www.php.net/manual/en/function.is-readable.php
>   http://www.php.net/manual/en/function.fileperms.php
>   http://www.php.net/manual/en/function.chown.php
>
> Of course, there's a lot more others under
>
>   http://www.php.net/manual/en/ref.filesystem.php
>
> HTH,
>
> - E
>
> --
> 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: Re: [PHP] file uploads problem

2002-09-24 Thread @ Edwin
Jaski,

On Tuesday, September 24, 2002 5:07 PM
Jaski wrote:
> No Edwin .. I can't do any thing to that file .. not even from my
> ftp client .. can't download can't change permissions ..
>

I think you won't be able to do anything with the file IF you use your ftp
client. The reason is because *you* don't own the file so you can't read it
nor change it's permissions. Your *script(s)* owns the file so most probably
if you use another script to read and change the permissions, the script
would be able to do it. In other words, use your php script to read and
change the permissions. Perhaps, you'd like to play with these functions and
see what's happening...

  http://www.php.net/manual/en/function.is-readable.php
  http://www.php.net/manual/en/function.fileperms.php
  http://www.php.net/manual/en/function.chown.php

Of course, there's a lot more others under

  http://www.php.net/manual/en/ref.filesystem.php

HTH,

- E

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


Re: [PHP] file uploads problem

2002-09-24 Thread Marek Kilimajer

What I don't understand is how can your webserver create a file and then 
not to have permission to read it.
What is your setup?

Jaski wrote:

> No Edwin .. I can't do any thing to that file .. not even from my ftp 
> client .. can't download can't change permissions ..
>
> The server is managed by rackspace .. I doubt they would do some thing 
> like running apache as root which I "hear" is a v foolish thing to do  
> (frankly I don't know how to figure it out myself ..if that is the 
> case .. phpinfo() did not say any thing on that.)
>
> A brief restatement of problem
>
> File uploaded via HTTP POST to /tmp  OK
>
> After this I tried the following three things and none worked.
>
> a) fopen("/tmp/temp_file_name","rb")  FAILED (Operation not permitted)
> b) copy($tempfile, "/place/to/put/uploaded/file") FAILED
> c) move_uploaded_file($userfile, "/place/to/put/uploaded/file") DID 
> COPY BUT file had -rw permissions, and could not open this 
> file either... so back to square 1
>
> The directory in "/place/to/put/uploaded/file is mode 777 .
>
>
> Still fighting it out.
> Regards
> Jaski
>
>
>
> On Tue, 24 Sep 2002 @ Edwin wrote :
>
>> Just a comment...
>>
>> On Tuesday, September 24, 2002 1:39 PM
>> Jaski wrote:
>> 
>> > I tried to copy this file using
>> > move_uploaded_file($userfile, "/place/to/put/uploaded/file");
>> >
>> > and here a strange thing happened. The file was successfully
>> > copied BUT it had permissions like -rw-- which I interpret as
>> > only accessible to root. I tried copy() function instead and it
>> > failed.
>> >
>>
>> ...having that "permission" doesn't necessarily mean that it's only
>> accessible to root--unless of course you're running Apache as root, 
>> which I
>> doubt you'd do.
>>
>> Anyway, if the file was successfully copied why not just try to open it
>> there?
>>
>> - E
>
>
>


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




Re: Re: [PHP] file uploads problem

2002-09-24 Thread Jaski

No Edwin .. I can't do any thing to that file .. not even from my 
ftp client .. can't download can't change permissions ..

The server is managed by rackspace .. I doubt they would do some 
thing like running apache as root which I "hear" is a v foolish 
thing to do  (frankly I don't know how to figure it out myself 
..if that is the case .. phpinfo() did not say any thing on 
that.)

A brief restatement of problem

File uploaded via HTTP POST to /tmp  OK

After this I tried the following three things and none worked.

a) fopen("/tmp/temp_file_name","rb")  FAILED (Operation not 
permitted)
b) copy($tempfile, "/place/to/put/uploaded/file") FAILED
c) move_uploaded_file($userfile, "/place/to/put/uploaded/file") 
DID COPY BUT file had -rw permissions, and could not open 
this file either... so back to square 1

The directory in "/place/to/put/uploaded/file is mode 777 .


Still fighting it out.
Regards
Jaski



On Tue, 24 Sep 2002 @ Edwin wrote :
>Just a comment...
>
>On Tuesday, September 24, 2002 1:39 PM
>Jaski wrote:
>
> > I tried to copy this file using
> > move_uploaded_file($userfile, 
>"/place/to/put/uploaded/file");
> >
> > and here a strange thing happened. The file was successfully
> > copied BUT it had permissions like -rw-- which I interpret 
>as
> > only accessible to root. I tried copy() function instead and 
>it
> > failed.
> >
>
>...having that "permission" doesn't necessarily mean that it's 
>only
>accessible to root--unless of course you're running Apache as 
>root, which I
>doubt you'd do.
>
>Anyway, if the file was successfully copied why not just try to 
>open it
>there?
>
>- E


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




Re: [PHP] file uploads problem

2002-09-23 Thread @ Edwin
Just a comment...

On Tuesday, September 24, 2002 1:39 PM
Jaski wrote:

> I tried to copy this file using
> move_uploaded_file($userfile, "/place/to/put/uploaded/file");
>
> and here a strange thing happened. The file was successfully
> copied BUT it had permissions like -rw-- which I interpret as
> only accessible to root. I tried copy() function instead and it
> failed.
>

...having that "permission" doesn't necessarily mean that it's only
accessible to root--unless of course you're running Apache as root, which I
doubt you'd do.

Anyway, if the file was successfully copied why not just try to open it
there?

- E

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


Re: Re: [PHP] file uploads problem

2002-09-23 Thread Jaski

Thanks .. but I think you are saying exactly what I wrote  I was 
doing .. except that you have used exec("cp $file $path") while I 
tried PHP's copy() function .. I don't think that will make a 
difference...though will give that a try any way.

Forgot to mention in my previous mail that the directory where I 
am trying to copy the uploaded file from /tmp is in 777 mode 
already.


Jaski

On Tue, 24 Sep 2002 Oscar F wrote :
>Try:
>
>$upload = "/path/to/copy/";
>$upload_path = "$upload/$file_filename";
>if (is_uploaded_file($file)) {
>Exec("cp $filename $upload_path");
>}
>
>Then you have the file at /path/to/copy/, and you can 
>do whatever you want with it. (I'm assuming the file field of the 
>form is called "file", and that /path/to/copy/ has permissions 
>set so that PHP can write to it, 777 will work for sure, but I'm 
>not 100% positive which one would be best due to security and 
>stuff.).
>
>HTH. Oscar.-
>
>Jaski wrote:
>
>>Hi,
>>(Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).
>>
>>I am trying to write a script to send emails. It needs to 
>>support attachments. The point where I am stuck is after the 
>>file to be attached gets uploaded to /tmp as /tmp/tempfilename 
>>thorough an HTTP POST form.
>>
>>I am not able to open that file directly .. follwing error shows 
>>up.
>>
>>Warning: fopen("/tmp/phpOaILXx","rb") - Operation not
>>permitted in
>>/var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
>>on line 254
>>
>>
>>I tried to copy this file using
>>move_uploaded_file($userfile, "/place/to/put/uploaded/file");
>>
>>and here a strange thing happened. The file was successfully 
>>copied BUT it had permissions like -rw-- which I interpret 
>>as only accessible to root. I tried copy() function instead and 
>>it failed.
>>
>>
>>I think I have tried every thing I could think of .. so please 
>>HELP :)
>>
>>jaski
>>
>>NP. I am subscribed to the digest version so kindly cc any 
>>replies to me as well. Thanks.
>>
>
>


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




Re: [PHP] file uploads problem

2002-09-23 Thread Oscar F

Try:

$upload = "/path/to/copy/";
$upload_path = "$upload/$file_filename";
if (is_uploaded_file($file)) {
 Exec("cp $filename $upload_path");
}

Then you have the file at /path/to/copy/, and you can do 
whatever you want with it. (I'm assuming the file field of the form is 
called "file", and that /path/to/copy/ has permissions set so that PHP 
can write to it, 777 will work for sure, but I'm not 100% positive which 
one would be best due to security and stuff.).

HTH. Oscar.-

Jaski wrote:

> Hi,
> (Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).
>
> I am trying to write a script to send emails. It needs to support 
> attachments. The point where I am stuck is after the file to be 
> attached gets uploaded to /tmp as /tmp/tempfilename thorough an HTTP 
> POST form.
>
> I am not able to open that file directly .. follwing error shows up.
>
> Warning: fopen("/tmp/phpOaILXx","rb") - Operation not
> permitted in
> /var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
> on line 254
>
>
> I tried to copy this file using
> move_uploaded_file($userfile, "/place/to/put/uploaded/file");
>
> and here a strange thing happened. The file was successfully copied 
> BUT it had permissions like -rw-- which I interpret as only 
> accessible to root. I tried copy() function instead and it failed.
>
>
> I think I have tried every thing I could think of .. so please HELP :)
>
> jaski
>
> NP. I am subscribed to the digest version so kindly cc any replies to 
> me as well. Thanks.
>



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




[PHP] file uploads problem

2002-09-23 Thread Jaski

Hi,
(Linux RH 7.1, Apache/1.3.22, PHP 4.0.6).

I am trying to write a script to send emails. It needs to support 
attachments. The point where I am stuck is after the file to be 
attached gets uploaded to /tmp as /tmp/tempfilename thorough an 
HTTP POST form.

I am not able to open that file directly .. follwing error shows 
up.

Warning: fopen("/tmp/phpOaILXx","rb") - Operation not
permitted in
/var/www/vhosts/mydomain/httpsdocs/lib/email.inc.php
on line 254


I tried to copy this file using
move_uploaded_file($userfile, "/place/to/put/uploaded/file");

and here a strange thing happened. The file was successfully 
copied BUT it had permissions like -rw-- which I interpret as 
only accessible to root. I tried copy() function instead and it 
failed.


I think I have tried every thing I could think of .. so please 
HELP :)

jaski

NP. I am subscribed to the digest version so kindly cc any replies 
to me as well. Thanks.

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




Re: [PHP] Re: php file uploads and type 'image/pjpeg' ???

2002-05-13 Thread Miguel Cruz

On Tue, 14 May 2002, John Ngo wrote:
> actually i looked up pjpeg
> turns out its an actual filetype in its own right haha
> 
> pjpeg uses progressive encoding as opposed to normal jpeg or something
> whats weirder is everyfile i've tried on my computer appears to be pjpeg
> encoded

You're probably using Windows, which can't tell the difference.

miguel


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




[PHP] Re: php file uploads and type 'image/pjpeg' ???

2002-05-13 Thread John Ngo

actually i looked up pjpeg
turns out its an actual filetype in its own right haha

pjpeg uses progressive encoding as opposed to normal jpeg or something
whats weirder is everyfile i've tried on my computer appears to be pjpeg
encoded

"Jochem" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I guess you could check the $userfile_type for the correct type.
>
>
> "John Ngo" <[EMAIL PROTECTED]> schreef in bericht
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > basically i've got a file upload script (that works)
> >
> > what i want to do now is restrict it to filetypes of 'image/jpeg'
> > however now i can't upload jpegs cause their filetype appears to be
> > 'image/pjpeg'
> >
> > does anyone know of what could be happening here?
> >
> >
> >
>
>



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




[PHP] Re: php file uploads and type 'image/pjpeg' ???

2002-05-13 Thread Jochem

I guess you could check the $userfile_type for the correct type.


"John Ngo" <[EMAIL PROTECTED]> schreef in bericht
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> basically i've got a file upload script (that works)
>
> what i want to do now is restrict it to filetypes of 'image/jpeg'
> however now i can't upload jpegs cause their filetype appears to be
> 'image/pjpeg'
>
> does anyone know of what could be happening here?
>
>
>



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




[PHP] php file uploads and type 'image/pjpeg' ???

2002-05-13 Thread John Ngo

basically i've got a file upload script (that works)

what i want to do now is restrict it to filetypes of 'image/jpeg'
however now i can't upload jpegs cause their filetype appears to be
'image/pjpeg'

does anyone know of what could be happening here?




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




[PHP] File Uploads Security Fix

2002-05-03 Thread Miguel Loureiro

Hello,
after copy do_download.php to php4.0.6/main what I have to do?
T.Y.

-- 
Best Regards

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




Re: [PHP] File Uploads

2002-02-06 Thread Jeff Sheltren

The username will be the same username that apache is running as, which you 
can specify in your httpd.conf file.

-Jeff

At 10:32 AM 2/6/2002 -0500, Ben Crawford wrote:
>I apoligize if this question has already been asked but
>
>I am looking to upload files to my server.  I use a form and can get the
>files to upload as user nobody with a random file name on my Linux box.
>That is the problem, the user is 'nobody'.  This is either an Apache
>thing or a PHP thing and I haven't been able to figure it out.  Is there
>some sort of login that I should be doing.  I have tried the basic login
>just to check if that will work but it doesn't.
>
>Ben



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




[PHP] File Uploads

2002-02-06 Thread Ben Crawford

I apoligize if this question has already been asked but

I am looking to upload files to my server.  I use a form and can get the
files to upload as user nobody with a random file name on my Linux box.
That is the problem, the user is 'nobody'.  This is either an Apache
thing or a PHP thing and I haven't been able to figure it out.  Is there
some sort of login that I should be doing.  I have tried the basic login
just to check if that will work but it doesn't.

Ben


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




Re: [PHP] File Uploads

2001-09-13 Thread Christopher CM Allen

Thanks Much Martin!


--ccma
> --snip--
> 
> good luck!
> 
> /Martin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




  1   2   >