RE: [PHP] Upload size limit stays at 8MB

2011-05-06 Thread Ross Hansen

Hey,

There is also an option for post_max_size = xM
x being the number specified.
This should be located in your php.ini file somewhere. check to make sure that 
this is set high enough else it could also be causing the issue.



 To: php-general@lists.php.net
 Date: Thu, 5 May 2011 21:51:26 -0700
 From: ji...@sohnen-moe.com
 Subject: [PHP] Upload size limit stays at 8MB
 
 Hello,
   apache v2.2.15 (Linux/SUSE)
   phpv5.3.3
   linux  v2.6.34.7-0.7-desktop #1 SMP
 
   I updated /etc/php5/apache2/php.ini to change
 upload_max_filesize = 2M
 to
 upload_max_filesize = 60M.
   php_info() shows the changed value; echo
 ini_get(upload_max_filesize) shows the changed value. Yet when I
 attempt an upload, I get this in the error log:
 
 PHP Warning:  POST Content-Length of 39246714 bytes exceeds the limit of
 8388608 bytes in Unknown on line 0, referer: http://www.sma.com/sma/upload/
 
   Hmm. Unknown on line 0? A bit vague.
   8MB max seems a bit less than the 60MB listed.
   Where else could PHP be getting settings info?
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
  

RE: [PHP] Upload size limit stays at 8MB

2011-05-06 Thread Ross Hansen

Apart from the possible security issues with posting content or information i 
don't believe that there is any others for posting large amounts of 
information. Just as long as you are aware that it is all being posted over 
plain text so if you have any sensitive data you may want to look at setting up 
a HTTPS.

otherwise, glad to know that your issues is solved. :)

 Date: Fri, 6 May 2011 10:10:31 -0700
 From: ji...@sohnen-moe.com
 To: hansen.r...@live.com.au
 Subject: Re: [PHP] Upload size limit stays at 8MB
 
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 05/05/2011 11:52 PM, Ross Hansen wrote:
  
  There is also an option for post_max_size = xM
  x being the number specified.
  This should be located in your php.ini file somewhere. check to make sure 
  that this is set high enough else it could also be causing the issue.
  
   Okay, that was it. Thanks!
   Are the any security issues with allowing a large POST size?
 
 - -- 
 James Moe
 moe dot james at sohnen-moe dot com
 520.743.3936
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v2.0.15 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
 
 iEYEARECAAYFAk3EK4cACgkQzTcr8Prq0ZMB7ACdEhMzHq40Gp8GzFjf+9SAeshc
 NMsAnAhOxVtDDXj7yPSrmh7LjR3UcYlY
 =ariZ
 -END PGP SIGNATURE-
  

Re: [PHP] upload big files

2011-04-17 Thread Tolas Anon
On Thu, Apr 14, 2011 at 10:36 AM, Ricardo Martinez harisel...@gmail.com wrote:
 Hi List!

 Need can upload big files ( around 300MB ) the system must be easy of use (
 cann't use ftp ).

 Was thinking in make it, using a form with post, and update the cfg files
 for can upload big files.
 But don't know how it going to work. I think that can give a lot of errors
 or be unestable.

 Just asking if anyone had a project like this one ;)

 Greetings!


I've got good experiences with http://jumploader.com
It's Java, and can do HTTP uploads  2Gb fine, with the partitioned php uploader

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



Re: [PHP] upload big files

2011-04-17 Thread Ricardo Martinez
thanks guys for answer,

i'm thinking in use FTP with PHP, never did it before, but don't must be
dificult.
I'll tell to you as finished it ;)

thanks!

On Sat, Apr 16, 2011 at 3:54 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

  On Sat, 2011-04-16 at 15:47 +0200, Daniel Jost wrote:

 okay, sorry, you are right. i thought it would be purely javascript but
 forgot the flash component.



  but if you don't want your user to blindly upload 300mb over hours
 (depending on his internet connection) there are no other possibilities than
 using one of that components. or does anyone have another solution?

  2011/4/16 Ashley Sheridan a...@ashleysheridan.co.uk


   On Sat, 2011-04-16 at 15:36 +0200, Daniel Jost wrote:

 hi!

 this form would not really be a nice solution to upload 300mb. there would
 be no progress bar and no other possibility for the user to get feedback.

 you should consider to use a java uploaded - or a bit nicer - a javascript
 based solution like this: http://www.uploadify.com/

 http://www.uploadify.com/daniel

 2011/4/14 Ricardo Martinez harisel...@gmail.com

  Hi List!
 
  Need can upload big files ( around 300MB ) the system must be easy of use (
  cann't use ftp ).
 
  Was thinking in make it, using a form with post, and update the cfg files
  for can upload big files.
  But don't know how it going to work. I think that can give a lot of errors
  or be unestable.
 
  Just asking if anyone had a project like this one ;)
 
  Greetings!
 
  --
  Ricardo
  ___
  IT Architect
  website: http://www.pulsarinara.com
 



   Uploadify might appear to be purely Javascript, but it is in-fact Flash
 doing the actual upload work. I've used this before, and found it impossible
 to use without a mouse and defaults to a standard upload input element if
 you don't have Flash player installed on that browser. These might not seem
 like major issues, but I for one don't have Flash installed on my Windows
 partition (found it to be too much of a security risk) and there are plenty
 of people out there who can't use a mouse due to various disabilities. I'd
 definitely go with the Java one if you can, as this is more portable (I
 believe you can get them to run on iOS devices where Flash would be a no-go)
 and would allow non-mouse navigation.

 Having said that, the last time I used Uploadify was about a year ago, so
 things may have changed since then with regards to the non-mouse
 interaction.


   --
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk







 The last time I had to do something like this was for large video files
 which could sometimes go beyond 2GB. In the end I allowed the files to be
 transferred over FTP (with the same username/password that they logged in
 via the web interface), but also included a Java applet in the web interface
 as well so that it appeared to allow the upload as normal, but behind the
 scenes it was all FTP. HTTP isn't great for large uploads, but a protocol
 like FTP is perfectly suited for it.


   --
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





-- 
Ricardo
___
IT Architect
website: http://www.pulsarinara.com


Re: [PHP] upload big files

2011-04-17 Thread Ashley Sheridan
On Sun, 2011-04-17 at 19:12 +0200, Ricardo Martinez wrote:

 thanks guys for answer,
 
 i'm thinking in use FTP with PHP, never did it before, but don't must be
 dificult.
 I'll tell to you as finished it ;)
 
 thanks!
 
 On Sat, Apr 16, 2011 at 3:54 PM, Ashley Sheridan
 a...@ashleysheridan.co.ukwrote:
 
   On Sat, 2011-04-16 at 15:47 +0200, Daniel Jost wrote:
 
  okay, sorry, you are right. i thought it would be purely javascript but
  forgot the flash component.
 
 
 
   but if you don't want your user to blindly upload 300mb over hours
  (depending on his internet connection) there are no other possibilities than
  using one of that components. or does anyone have another solution?
 
   2011/4/16 Ashley Sheridan a...@ashleysheridan.co.uk
 
 
On Sat, 2011-04-16 at 15:36 +0200, Daniel Jost wrote:
 
  hi!
 
  this form would not really be a nice solution to upload 300mb. there would
  be no progress bar and no other possibility for the user to get feedback.
 
  you should consider to use a java uploaded - or a bit nicer - a javascript
  based solution like this: http://www.uploadify.com/
 
  http://www.uploadify.com/daniel
 
  2011/4/14 Ricardo Martinez harisel...@gmail.com
 
   Hi List!
  
   Need can upload big files ( around 300MB ) the system must be easy of use 
   (
   cann't use ftp ).
  
   Was thinking in make it, using a form with post, and update the cfg files
   for can upload big files.
   But don't know how it going to work. I think that can give a lot of errors
   or be unestable.
  
   Just asking if anyone had a project like this one ;)
  
   Greetings!
  
   --
   Ricardo
   ___
   IT Architect
   website: http://www.pulsarinara.com
  
 
 
 
Uploadify might appear to be purely Javascript, but it is in-fact Flash
  doing the actual upload work. I've used this before, and found it impossible
  to use without a mouse and defaults to a standard upload input element if
  you don't have Flash player installed on that browser. These might not seem
  like major issues, but I for one don't have Flash installed on my Windows
  partition (found it to be too much of a security risk) and there are plenty
  of people out there who can't use a mouse due to various disabilities. I'd
  definitely go with the Java one if you can, as this is more portable (I
  believe you can get them to run on iOS devices where Flash would be a no-go)
  and would allow non-mouse navigation.
 
  Having said that, the last time I used Uploadify was about a year ago, so
  things may have changed since then with regards to the non-mouse
  interaction.
 
 
--
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 
 
 
 
  The last time I had to do something like this was for large video files
  which could sometimes go beyond 2GB. In the end I allowed the files to be
  transferred over FTP (with the same username/password that they logged in
  via the web interface), but also included a Java applet in the web interface
  as well so that it appeared to allow the upload as normal, but behind the
  scenes it was all FTP. HTTP isn't great for large uploads, but a protocol
  like FTP is perfectly suited for it.
 
 
--
  Thanks,
  Ash
  http://www.ashleysheridan.co.uk
 
 
 
 
 


The FTP functions in PHP are just for connecting to an FTP server from
PHP, which itself is run on a server, so you won't be able to use those
functions to allow people to upload files to your server.
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] upload big files

2011-04-16 Thread Daniel Jost
hi!

this form would not really be a nice solution to upload 300mb. there would
be no progress bar and no other possibility for the user to get feedback.

you should consider to use a java uploaded - or a bit nicer - a javascript
based solution like this: http://www.uploadify.com/

http://www.uploadify.com/daniel

2011/4/14 Ricardo Martinez harisel...@gmail.com

 Hi List!

 Need can upload big files ( around 300MB ) the system must be easy of use (
 cann't use ftp ).

 Was thinking in make it, using a form with post, and update the cfg files
 for can upload big files.
 But don't know how it going to work. I think that can give a lot of errors
 or be unestable.

 Just asking if anyone had a project like this one ;)

 Greetings!

 --
 Ricardo
 ___
 IT Architect
 website: http://www.pulsarinara.com



Re: [PHP] upload big files

2011-04-16 Thread Ashley Sheridan
On Sat, 2011-04-16 at 15:36 +0200, Daniel Jost wrote:

 hi!
 
 this form would not really be a nice solution to upload 300mb. there would
 be no progress bar and no other possibility for the user to get feedback.
 
 you should consider to use a java uploaded - or a bit nicer - a javascript
 based solution like this: http://www.uploadify.com/
 
 http://www.uploadify.com/daniel
 
 2011/4/14 Ricardo Martinez harisel...@gmail.com
 
  Hi List!
 
  Need can upload big files ( around 300MB ) the system must be easy of use (
  cann't use ftp ).
 
  Was thinking in make it, using a form with post, and update the cfg files
  for can upload big files.
  But don't know how it going to work. I think that can give a lot of errors
  or be unestable.
 
  Just asking if anyone had a project like this one ;)
 
  Greetings!
 
  --
  Ricardo
  ___
  IT Architect
  website: http://www.pulsarinara.com
 


Uploadify might appear to be purely Javascript, but it is in-fact Flash
doing the actual upload work. I've used this before, and found it
impossible to use without a mouse and defaults to a standard upload
input element if you don't have Flash player installed on that browser.
These might not seem like major issues, but I for one don't have Flash
installed on my Windows partition (found it to be too much of a security
risk) and there are plenty of people out there who can't use a mouse due
to various disabilities. I'd definitely go with the Java one if you can,
as this is more portable (I believe you can get them to run on iOS
devices where Flash would be a no-go) and would allow non-mouse
navigation.

Having said that, the last time I used Uploadify was about a year ago,
so things may have changed since then with regards to the non-mouse
interaction.


-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] upload big files

2011-04-16 Thread Daniel Jost
okay, sorry, you are right. i thought it would be purely javascript but
forgot the flash component.

but if you don't want your user to blindly upload 300mb over hours
(depending on his internet connection) there are no other possibilities than
using one of that components. or does anyone have another solution?

2011/4/16 Ashley Sheridan a...@ashleysheridan.co.uk

  On Sat, 2011-04-16 at 15:36 +0200, Daniel Jost wrote:

 hi!

 this form would not really be a nice solution to upload 300mb. there would
 be no progress bar and no other possibility for the user to get feedback.

 you should consider to use a java uploaded - or a bit nicer - a javascript
 based solution like this: http://www.uploadify.com/

 http://www.uploadify.com/daniel

 2011/4/14 Ricardo Martinez harisel...@gmail.com

  Hi List!
 
  Need can upload big files ( around 300MB ) the system must be easy of use (
  cann't use ftp ).
 
  Was thinking in make it, using a form with post, and update the cfg files
  for can upload big files.
  But don't know how it going to work. I think that can give a lot of errors
  or be unestable.
 
  Just asking if anyone had a project like this one ;)
 
  Greetings!
 
  --
  Ricardo
  ___
  IT Architect
  website: http://www.pulsarinara.com
 


 Uploadify might appear to be purely Javascript, but it is in-fact Flash
 doing the actual upload work. I've used this before, and found it impossible
 to use without a mouse and defaults to a standard upload input element if
 you don't have Flash player installed on that browser. These might not seem
 like major issues, but I for one don't have Flash installed on my Windows
 partition (found it to be too much of a security risk) and there are plenty
 of people out there who can't use a mouse due to various disabilities. I'd
 definitely go with the Java one if you can, as this is more portable (I
 believe you can get them to run on iOS devices where Flash would be a no-go)
 and would allow non-mouse navigation.

 Having said that, the last time I used Uploadify was about a year ago, so
 things may have changed since then with regards to the non-mouse
 interaction.


   --
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk





Re: [PHP] upload big files

2011-04-16 Thread Ashley Sheridan
On Sat, 2011-04-16 at 15:47 +0200, Daniel Jost wrote:

 okay, sorry, you are right. i thought it would be purely javascript
 but forgot the flash component.
 
 
 
 but if you don't want your user to blindly upload 300mb over hours
 (depending on his internet connection) there are no other
 possibilities than using one of that components. or does anyone have
 another solution?
 
 
 2011/4/16 Ashley Sheridan a...@ashleysheridan.co.uk
 
 
 On Sat, 2011-04-16 at 15:36 +0200, Daniel Jost wrote: 
 
  hi!
  
  this form would not really be a nice solution to upload 300mb. 
 there would
  be no progress bar and no other possibility for the user to get 
 feedback.
  
  you should consider to use a java uploaded - or a bit nicer - a 
 javascript
  based solution like this: http://www.uploadify.com/
  
  http://www.uploadify.com/daniel
  
  2011/4/14 Ricardo Martinez harisel...@gmail.com
  
   Hi List!
  
   Need can upload big files ( around 300MB ) the system must be 
 easy of use (
   cann't use ftp ).
  
   Was thinking in make it, using a form with post, and update the 
 cfg files
   for can upload big files.
   But don't know how it going to work. I think that can give a lot 
 of errors
   or be unestable.
  
   Just asking if anyone had a project like this one ;)
  
   Greetings!
  
   --
   Ricardo
   ___
   IT Architect
   website: http://www.pulsarinara.com
  
 
 
 
 
 Uploadify might appear to be purely Javascript, but it is
 in-fact Flash doing the actual upload work. I've used this
 before, and found it impossible to use without a mouse and
 defaults to a standard upload input element if you don't have
 Flash player installed on that browser. These might not seem
 like major issues, but I for one don't have Flash installed on
 my Windows partition (found it to be too much of a security
 risk) and there are plenty of people out there who can't use a
 mouse due to various disabilities. I'd definitely go with the
 Java one if you can, as this is more portable (I believe you
 can get them to run on iOS devices where Flash would be a
 no-go) and would allow non-mouse navigation.
 
 Having said that, the last time I used Uploadify was about a
 year ago, so things may have changed since then with regards
 to the non-mouse interaction.
 
 
 -- 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 
 


The last time I had to do something like this was for large video files
which could sometimes go beyond 2GB. In the end I allowed the files to
be transferred over FTP (with the same username/password that they
logged in via the web interface), but also included a Java applet in the
web interface as well so that it appeared to allow the upload as normal,
but behind the scenes it was all FTP. HTTP isn't great for large
uploads, but a protocol like FTP is perfectly suited for it.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Upload Progress Meter

2011-03-24 Thread Brad Broerman
Essentially, they all require Flash or Java... 

Most use Flash...  

If you want one that is in Java, and is scriptable in JavaScript, I have one
on my website: http://www.bbroerman.net/code.html

-Brad


-Original Message-
From: Floyd Resler [mailto:fres...@adex-intl.com] 
Sent: Wednesday, March 23, 2011 10:29 AM
To: sstap...@mnsi.net
Cc: PHP
Subject: Re: [PHP] Upload Progress Meter


On Mar 23, 2011, at 10:10 AM, Steve Staples wrote:

 On Wed, 2011-03-23 at 09:59 -0400, Floyd Resler wrote:
 I am in need of an upload progress meter.  I've seen plenty of tutorials
=
 on-line requiring installing modules, hooks, patches, etc.  However, my =
 Wordpress install accomplished this without me having to make any =
 modifications to my PHP install.  So, how is it done?
 
 Thanks!
 Floyd
 
 
 you can google this...
 
 jquery upload progress meter
 
 or:
 http://www.nixboxdesigns.com/demos/jquery-uploadprogress.php
 
 http://www.bitrepository.com/uploading-files-with-progress-bar.html
 
 
 
 Steve
 

I'll check it out!

Thanks!
Floyd




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



Re: [PHP] Upload Progress Meter

2011-03-24 Thread Donovan Brooke

Brad Broerman wrote:

Essentially, they all require Flash or Java...



You are generally talking about two different sides of the client/server 
relationship.. unless you are talking about Applets, right?... so I have 
an issue with the statement. If jquery does one (as mentioned), it's 
likely not Flash nor Java.


I'm not trying to be an arse or anything, but I don't see it being that 
limiting. I do think it's difficult to recommend a progress meter when 
there is not a lot of

info given of what is being metered. If you need to meter the processes
for javascript, then you'd likely use javascript, if you need to meter
a server-side intensive task, then you could use a server-side method, 
or a combination of things.


It all comes down to a pretty graphic to watch while your waiting for a 
task to finish. ;-)


Donovan




--
D Brooke

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



Re: [PHP] Upload Progress Meter

2011-03-23 Thread Steve Staples
On Wed, 2011-03-23 at 09:59 -0400, Floyd Resler wrote:
 I am in need of an upload progress meter.  I've seen plenty of tutorials =
 on-line requiring installing modules, hooks, patches, etc.  However, my =
 Wordpress install accomplished this without me having to make any =
 modifications to my PHP install.  So, how is it done?
 
 Thanks!
 Floyd
 

you can google this...

jquery upload progress meter

or:
http://www.nixboxdesigns.com/demos/jquery-uploadprogress.php

http://www.bitrepository.com/uploading-files-with-progress-bar.html



Steve


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



Re: [PHP] Upload Progress Meter

2011-03-23 Thread Floyd Resler

On Mar 23, 2011, at 10:10 AM, Steve Staples wrote:

 On Wed, 2011-03-23 at 09:59 -0400, Floyd Resler wrote:
 I am in need of an upload progress meter.  I've seen plenty of tutorials =
 on-line requiring installing modules, hooks, patches, etc.  However, my =
 Wordpress install accomplished this without me having to make any =
 modifications to my PHP install.  So, how is it done?
 
 Thanks!
 Floyd
 
 
 you can google this...
 
 jquery upload progress meter
 
 or:
 http://www.nixboxdesigns.com/demos/jquery-uploadprogress.php
 
 http://www.bitrepository.com/uploading-files-with-progress-bar.html
 
 
 
 Steve
 

I'll check it out!

Thanks!
Floyd



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



Re: [PHP] Upload using FTP commands

2010-08-26 Thread Dan McCullough
Take a look here:
http://us.php.net/manual/en/ref.ftp.php

You might have some issues with the memory limit in PHP so that might have
to be boosted for 20MB files.

On Thu, Aug 26, 2010 at 12:24 PM, Matthew Croud m...@obviousdigital.comwrote:


 Hi,

 I want to give my client the ability to upload large files ( around 20MB )
 to a webspace.
 I reckon that using the FTP commands of PHP would be the best bet, but is
 it possible to allow them to do this through an online form.

 This is my vision: the client logs in to a form that has an upload button,
 and the upload button uses the FTP commands to upload the file.

 Is that do-able in PHP ?

 Cheers!







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




Re: [PHP] Upload using FTP commands

2010-08-26 Thread Ashley Sheridan
On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:

 Hi,
 
 I want to give my client the ability to upload large files ( around  
 20MB ) to a webspace.
 I reckon that using the FTP commands of PHP would be the best bet, but  
 is it possible to allow them to do this through an online form.
 
 This is my vision: the client logs in to a form that has an upload  
 button, and the upload button uses the FTP commands to upload the file.
 
 Is that do-able in PHP ?
 
 Cheers!
 
 
 
 
 
 
 

What would be the point?

You would have to set up your server to allow large files to be uploaded
in order for them to be used by PHP, and by that time, unless you're
putting them onto a remote server, there's no point in using the FTP
functions of PHP. What I've found quite reliable is to use PHP to create
FTP user accounts, which they can then log in to and upload files as
they need.

HTTP was not really intended for uploading large files, but FTP is, and
every OS has some form of FTP software built in that can be used very
easily.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload using FTP commands

2010-08-26 Thread Adam Richardson
On Thu, Aug 26, 2010 at 12:37 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Thu, 2010-08-26 at 17:24 +0100, Matthew Croud wrote:

  Hi,
 
  I want to give my client the ability to upload large files ( around
  20MB ) to a webspace.
  I reckon that using the FTP commands of PHP would be the best bet, but
  is it possible to allow them to do this through an online form.
 
  This is my vision: the client logs in to a form that has an upload
  button, and the upload button uses the FTP commands to upload the file.
 
  Is that do-able in PHP ?
 
  Cheers!
 
 
 
 
 
 
 

 What would be the point?

 You would have to set up your server to allow large files to be uploaded
 in order for them to be used by PHP, and by that time, unless you're
 putting them onto a remote server, there's no point in using the FTP
 functions of PHP.


Ashley makes a nice point.  When I have control over the server, I don't use
PHP's FTP capabilities at all.  However, on some shared severs you're only
HTTP upload options are to set a directory to 777 (Yikes!), or do some work
with PHP's FTP functions.

What I've done in the past on shared hosts is setup an upload FTP account
that has access to one directory.  Then, I develop a form to upload the
file.  Once a file is uploaded, I use PHP's FTP functions to place the file
in the directory.  This way I avoid the security issues of 777, maintain an
easy-to-use interface (some clients don't want to use FTP), and continue to
use the hosting the client prefers.  There is a cost to this method, but
sometimes it's worth the cost.

Just another way of doing things.

Adam

-- 
Nephtali:  PHP web framework that functions beautifully
http://nephtaliproject.com


Re: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:

 
 
 Good Day,
 
  
 
 I’m having an issue with IE8, when I go to load a file
 the program is not filling the $_FILES['user_file']['type']  .
 
 
   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
  
 On FireFox I get “image/jpeg.
  
 Any suggestions?
 Thanks,
 /Ernie
  
 
 
  

What do the other $_FILES fields say? Are they populated correctly?

I wouldn't rely on anything sent from the browser. IE is known to send
the mime type that matches the extension, not the contents of the file,
and for .jpg images it sends a different mime to every other browser
anyway, so it's pretty unreliable.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload file on IE8

2010-01-25 Thread Eric Lee
On Tue, Jan 26, 2010 at 6:41 AM, Ernie Kemp ernie.k...@sympatico.ca wrote:

   Good Day,



 I’m having an issue with IE8, when I go to load a file the
 program is not filling the $_FILES['user_file']['type']  .

   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.



 On FireFox I get “image/jpeg.



 Any suggestions?

 Thanks,

 /Ernie



  I remember a setting from some elsewhere IE 8 was disable set file path
 location
 by default from the options dialog. Did you enabled this already ? If not,
 you may give it a shoot to see than !


 Hope this help


 Eric,
 Regards,









Re: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Tue, 2010-01-26 at 07:33 +0800, Eric Lee wrote:

 On Tue, Jan 26, 2010 at 6:41 AM, Ernie Kemp ernie.k...@sympatico.ca wrote:
 
Good Day,
 
 
 
  I’m having an issue with IE8, when I go to load a file the
  program is not filling the $_FILES['user_file']['type']  .
 
When I display  “echo  Start.$_FILES['pix']['type'].End;” 
   in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
 
 
 
  On FireFox I get “image/jpeg.
 
 
 
  Any suggestions?
 
  Thanks,
 
  /Ernie
 
 
 
   I remember a setting from some elsewhere IE 8 was disable set file path
  location
  by default from the options dialog. Did you enabled this already ? If not,
  you may give it a shoot to see than !
 
 
  Hope this help
 
 
  Eric,
  Regards,
 
 
 
 
 
 
 


But you won't be able to guarantee every IE8 user will do this, so you
shouldn't develop the app in such a way that it needs to use the value
in the array. Also, as I've said, there isn't much point relying on this
value for any reason anyway, as it doesn't guarantee the file is
actually of that type.

Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] Upload file on IE8

2010-01-25 Thread Ernie Kemp
 

 

 

 

From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
Sent: January-25-10 5:53 PM
To: Ernie Kemp
Cc: 'PHP General List'
Subject: Re: [PHP] Upload file on IE8

 

On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:



 

Good Day,

 

I’m having an issue with IE8, when I go to load a file the 
program is not filling the $_FILES['user_file']['type']  .

 
  When I display  “echo  Start.$_FILES['pix']['type'].End;”  in 
IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
 
On FireFox I get “image/jpeg.
 
Any suggestions?
Thanks,
/Ernie
 

 

What do the other $_FILES fields say? Are they populated correctly?

I wouldn't rely on anything sent from the browser. IE is known to send the mime 
type that matches the extension, not the contents of the file, and for .jpg 
images it sends a different mime to every other browser anyway, so it's pretty 
unreliable. 


Thanks,
Ash
http://www.ashleysheridan.co.uk





With IE8,

  Using $_FILES the array results for  ‘name’ has the name of the file but 
‘type’, ‘tmp_name’ and ‘size’ are blanks.

 I tried enabling the “file path location” in IE8 option but the results 
are the same for $_FILES. 

 


   Firefox works displays all the values in the $_FILES array.

There must be a better way. Suggestions?

Thanks,

/Ernie



RE: [PHP] Upload file on IE8

2010-01-25 Thread Ashley Sheridan
On Mon, 2010-01-25 at 19:21 -0500, Ernie Kemp wrote:

 
 
 
 
 
 
 
 From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] 
 Sent: January-25-10 5:53 PM
 To: Ernie Kemp
 Cc: 'PHP General List'
 Subject: Re: [PHP] Upload file on IE8
 
  
 
 On Mon, 2010-01-25 at 17:41 -0500, Ernie Kemp wrote:
 
 
 
  
 
 Good Day,
 
  
 
 I’m having an issue with IE8, when I go to load a file the 
 program is not filling the $_FILES['user_file']['type']  .
 
  
   When I display  “echo  Start.$_FILES['pix']['type'].End;”  
 in IE8 I get “StartEnd” with nothing in between.  I expected “image/pjpeg.
  
 On FireFox I get “image/jpeg.
  
 Any suggestions?
 Thanks,
 /Ernie
  
 
 
 
 What do the other $_FILES fields say? Are they populated correctly?
 
 I wouldn't rely on anything sent from the browser. IE is known to send the 
 mime type that matches the extension, not the contents of the file, and for 
 .jpg images it sends a different mime to every other browser anyway, so it's 
 pretty unreliable. 
 
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk
 
 
 
 
 
 With IE8,
 
   Using $_FILES the array results for  ‘name’ has the name of the file 
 but ‘type’, ‘tmp_name’ and ‘size’ are blanks.
 
  I tried enabling the “file path location” in IE8 option but the results 
 are the same for $_FILES. 
 
  
 
 
Firefox works displays all the values in the $_FILES array.
 
 There must be a better way. Suggestions?
 
 Thanks,
 
 /Ernie
 


Don't use the value. There are a few different ways in PHP to get the
mime type of a file, which it does based on the contents of the file and
not its extension. This prevents someone from uploading an executable
virus for example by just changing the last three letters of the
filename.

Have a look at fileinfo() for this sort of thing.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload dir

2009-12-12 Thread Richard Quadling
2009/12/11 Ashley Sheridan a...@ashleysheridan.co.uk

 On Fri, 2009-12-11 at 15:44 +, Richard Quadling wrote:

 2009/12/11 kranthi kranthi...@gmail.com:
  How can i change the temporary upload directory?
  var_dump(ini_get('upload_tmp_dir'));      gives me (and that is set in 
  php.ini)
  string '/var/www/cgi-bin' (length=16)
 
  but
  var_dump($_FILES)                                                     gives 
  me
  'tmp_name' = string '/tmp/phpbSZ6WP' (length=14)
 
  var_dump(file_exists($_FILES['file']['tmp_name']));  gives me  (/tmp
  has permissions drwxrwxrwt and i never used file_move_upload or any
  similar functions)
  boolean false
 
  am I missing something here?
  Kranthi.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 Just assuming you could alter the upload_tmp_dir setting in your code
 (you can't) ...

 PHP puts the uploaded files into the upload_tmp_dir BEFORE your script
 runs, so changing it in your script essentially hides the uploaded
 files.

 PHP drops the files into directory A.
 PHP then runs your code.
 Your code changes the directory to B.
 Your code cannot see the files PHP put into A as your code is now looking in 
 B.

 But, as I said earlier, you can't use your code to change
 upload_tmp_dir. It can only be done at the system level (php.ini or
 httpd.conf). See [1] and [2].

 Regards,

 Richard Quadling.

 [1] http://docs.php.net/manual/en/ini.core.php#ini.sect.file-uploads
 [2] http://docs.php.net/manual/en/configuration.changes.modes.php

 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


 The only reason I can see for wanting to do this would be where several sites 
 exist on the same server and you might want each site to have its own 
 temporary upload directory. It won't have any bearing on how you handle the 
 uploads unless it becomes full.

 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



Another way to handle this is via php.ini sections [1]

Regards,

Richard.

[1] http://docs.php.net/manual/en/ini.sections.php

--
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Upload dir

2009-12-11 Thread kranthi
my mistake didn't use move_uploaded_file to see if the uploading
is working or not in the first case

but i could not understand why
   1. ini_get() is giving correct value while
$_FILES['file']['tmp_name'] is ignoring that.
   2. move_uploaded_file($_FILES['file']['tmp_name'], 'file.php'); is
working fine but file_exists($_FILES['file']['tmp_name']) is returning
false
   3. php_admin_value upload_tmp_dir /var/www/html
in httpd.conf seems to work ($_FILES['file']['tmp_name'] is not ignoring that);

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



Re: [PHP] Upload dir

2009-12-11 Thread Richard Quadling
2009/12/11 kranthi kranthi...@gmail.com:
 How can i change the temporary upload directory?
 var_dump(ini_get('upload_tmp_dir'));      gives me (and that is set in 
 php.ini)
 string '/var/www/cgi-bin' (length=16)

 but
 var_dump($_FILES)                                                     gives me
 'tmp_name' = string '/tmp/phpbSZ6WP' (length=14)

 var_dump(file_exists($_FILES['file']['tmp_name']));  gives me  (/tmp
 has permissions drwxrwxrwt and i never used file_move_upload or any
 similar functions)
 boolean false

 am I missing something here?
 Kranthi.

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



Just assuming you could alter the upload_tmp_dir setting in your code
(you can't) ...

PHP puts the uploaded files into the upload_tmp_dir BEFORE your script
runs, so changing it in your script essentially hides the uploaded
files.

PHP drops the files into directory A.
PHP then runs your code.
Your code changes the directory to B.
Your code cannot see the files PHP put into A as your code is now looking in B.

But, as I said earlier, you can't use your code to change
upload_tmp_dir. It can only be done at the system level (php.ini or
httpd.conf). See [1] and [2].

Regards,

Richard Quadling.

[1] http://docs.php.net/manual/en/ini.core.php#ini.sect.file-uploads
[2] http://docs.php.net/manual/en/configuration.changes.modes.php

-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Upload dir

2009-12-11 Thread Ashley Sheridan
On Fri, 2009-12-11 at 15:44 +, Richard Quadling wrote:

 2009/12/11 kranthi kranthi...@gmail.com:
  How can i change the temporary upload directory?
  var_dump(ini_get('upload_tmp_dir'));  gives me (and that is set in 
  php.ini)
  string '/var/www/cgi-bin' (length=16)
 
  but
  var_dump($_FILES) gives 
  me
  'tmp_name' = string '/tmp/phpbSZ6WP' (length=14)
 
  var_dump(file_exists($_FILES['file']['tmp_name']));  gives me  (/tmp
  has permissions drwxrwxrwt and i never used file_move_upload or any
  similar functions)
  boolean false
 
  am I missing something here?
  Kranthi.
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Just assuming you could alter the upload_tmp_dir setting in your code
 (you can't) ...
 
 PHP puts the uploaded files into the upload_tmp_dir BEFORE your script
 runs, so changing it in your script essentially hides the uploaded
 files.
 
 PHP drops the files into directory A.
 PHP then runs your code.
 Your code changes the directory to B.
 Your code cannot see the files PHP put into A as your code is now looking in 
 B.
 
 But, as I said earlier, you can't use your code to change
 upload_tmp_dir. It can only be done at the system level (php.ini or
 httpd.conf). See [1] and [2].
 
 Regards,
 
 Richard Quadling.
 
 [1] http://docs.php.net/manual/en/ini.core.php#ini.sect.file-uploads
 [2] http://docs.php.net/manual/en/configuration.changes.modes.php
 
 -- 
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling
 


The only reason I can see for wanting to do this would be where several
sites exist on the same server and you might want each site to have its
own temporary upload directory. It won't have any bearing on how you
handle the uploads unless it becomes full.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Upload dir

2009-12-10 Thread Gaurav Kumar
OK you used ini_get try using ini_set and set the temporary directory on
your server of your choice at run time in your script (top of the script or
any config file if you have one).

REMEMBER that you have access to that directory, should have full
permissions and also check the absolute server path is correct while you set
the directory.


More information on how to use ini_set to set the directory path- try
googling...

Gaurav Kumar
blog.oswebstudio.com



On Fri, Dec 11, 2009 at 10:59 AM, kranthi kranthi...@gmail.com wrote:

 How can i change the temporary upload directory?
 var_dump(ini_get('upload_tmp_dir'));  gives me (and that is set in
 php.ini)
 string '/var/www/cgi-bin' (length=16)

 but
 var_dump($_FILES) gives
 me
 'tmp_name' = string '/tmp/phpbSZ6WP' (length=14)

 var_dump(file_exists($_FILES['file']['tmp_name']));  gives me  (/tmp
 has permissions drwxrwxrwt and i never used file_move_upload or any
 similar functions)
 boolean false

 am I missing something here?
 Kranthi.

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




Re: [PHP] Upload dir

2009-12-10 Thread kranthi
i doubt i can use ini_set in this scenario

http://us3.php.net/manual/en/ini.core.php#ini.upload-tmp-dir

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



Re: [PHP] Upload file name not file

2009-05-02 Thread Ashley Sheridan
On Fri, 2009-05-01 at 12:38 -0400, Simon wrote:
 On Fri, May 1, 2009 at 9:34 AM, MikeP mpel...@princeton.edu wrote:
  I'm not trying to get the path, just the filename and size, I know how to
  get these, but that would include the file using $_Files, but I dont want to
  upload anything just use the filename and size.(without the path) to insert
  into a DB.
 
 Those are attributes of the file for which you dont have access
 remotely, and the only way to access this information without an
 upload will be using the same hacks as those spywarez use.  A
 technology like flash has read/write access to the remote user's disk
 (to a certain extent), you could use flash to get that information and
 make it send it to you, same thing could be done with ActiveX, etc...
 PHP, JS and HTTP protocol cannot acheive what you want.  (PHP is
 server-side, HTTP is for communication only, JS is client-side but
 locked down very much).
 
 However, at a very low level, it might be possible to achieve this in
 PHP, you could do the upload as if you wanted the whole file.  But the
 first packet received will contain the HTTP Header, and in the header,
 you should have all the info you need (filename and size of data).
 So, low-level speaking, as soon as you receive the first packet and
 have the info, you just need to close the connection (remote end might
 display an error msg saying the upload failed, etc).  PHP supports
 sockets connections, so you could make a basic 'server' that listens
 on another port to perform this.  But i see no way to acheive your
 goal without complications.
 
 Good luck!
 
If you don't set the enctype to multipart/form-data in your form, then
only the filename will be uploaded as part of the form. To get the file
size you would have to allow the file to be uploaded, even if only to
the temporary directory.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Upload file name not file

2009-05-01 Thread Simon
 Id like to use the popup file system box(input name=userfile type=file
 /) to choose a file name , but I only want to upload the filename , not the
 file. Can I do that?

You're not supposed to have any access to the remote visitor's
computer, and the path to the file being uploaded could contain
sensitive information (ie. like username of windows user).  There are
ways to get the information, even to read information on disk without
the use of a file upload form.  But they are/will be considered like
security threats and are/will be closed down.

IMO, whatever way you find to get this information is meant 1) not to
be portable accross different browsers and 2) to stop working
eventually.  (Of course unless you ask the user to explicitly type the
path in a text input)

What do you need this for?

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



Re: [PHP] Upload file name not file

2009-05-01 Thread MikeP
I'm not trying to get the path, just the filename and size, I know how to 
get these, but that would include the file using $_Files, but I dont want to 
upload anything just use the filename and size.(without the path) to insert 
into a DB.
Simon turne...@gmail.com wrote in message 
news:5f14cf5e0905010629s2253cc3bk2a83dbf8b754c...@mail.gmail.com...
 Id like to use the popup file system box(input name=userfile 
 type=file
 /) to choose a file name , but I only want to upload the filename , not 
 the
 file. Can I do that?

 You're not supposed to have any access to the remote visitor's
 computer, and the path to the file being uploaded could contain
 sensitive information (ie. like username of windows user).  There are
 ways to get the information, even to read information on disk without
 the use of a file upload form.  But they are/will be considered like
 security threats and are/will be closed down.

 IMO, whatever way you find to get this information is meant 1) not to
 be portable accross different browsers and 2) to stop working
 eventually.  (Of course unless you ask the user to explicitly type the
 path in a text input)

 What do you need this for? 



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



Re: [PHP] Upload file name not file

2009-05-01 Thread Simon
On Fri, May 1, 2009 at 9:34 AM, MikeP mpel...@princeton.edu wrote:
 I'm not trying to get the path, just the filename and size, I know how to
 get these, but that would include the file using $_Files, but I dont want to
 upload anything just use the filename and size.(without the path) to insert
 into a DB.

Those are attributes of the file for which you dont have access
remotely, and the only way to access this information without an
upload will be using the same hacks as those spywarez use.  A
technology like flash has read/write access to the remote user's disk
(to a certain extent), you could use flash to get that information and
make it send it to you, same thing could be done with ActiveX, etc...
PHP, JS and HTTP protocol cannot acheive what you want.  (PHP is
server-side, HTTP is for communication only, JS is client-side but
locked down very much).

However, at a very low level, it might be possible to achieve this in
PHP, you could do the upload as if you wanted the whole file.  But the
first packet received will contain the HTTP Header, and in the header,
you should have all the info you need (filename and size of data).
So, low-level speaking, as soon as you receive the first packet and
have the info, you just need to close the connection (remote end might
display an error msg saying the upload failed, etc).  PHP supports
sockets connections, so you could make a basic 'server' that listens
on another port to perform this.  But i see no way to acheive your
goal without complications.

Good luck!

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



Re: [PHP] Upload large 100MB of PDFS to MySQL using PHP, Is my settings ok?

2009-04-02 Thread Ian
On 2 Apr 2009 at 15:33, Louie Miranda wrote:

 Guys,
 
 I need help on the php and mysql configurations.
 
 I want to be able to upload  100MB to MySQL using PHP.
 
snip

  max_allowed_packet = 5M

Hi,

This may be the one that's stopping it.  

max_allowed_packet:
http://dev.mysql.com/doc/refman/5.0/en/server-system-
variables.html#sysvar_max_allowed_packet

If the SQL statement you are using goes over 5Mb, MySQL will cut the connection 
with an 
error.  It is strange that you are not seeing an error in your code thought.

Regards

Ian
-- 

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread Ashley Sheridan
On Mon, 2009-03-02 at 18:35 -0800, mike wrote:
 On Mon, Mar 2, 2009 at 3:29 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 
  There are a lot of free FTP Java applets out there, which you could
  easily integrate with a web page and your hosting. You'll have the
  advantage of a familiar interface, multiple uploads, queues, and
  progress bars. Worst case scenario, user has no Java and you have to
  offer a standard upload form.
 
 since it's java, you're getting into Michael's infinite paranoia soapbox... :)
 
 also it requires FTP credentials, or an FTP account, which makes life
 a living hell. firewalls, NATted setups, people finding out it's an
 open FTP, etc.
 
 If you are requiring an applet, I don't see why there is even a
 discussion. Go with Gears, no extra server code or configuration
 necessary.
 
 If you are anti-applet, you'll still need javascript, and depending on
 the file sizes you're dealing with, you'll need to modify the server
 configuration (which is out of a lot of people's control)
 
Whoever said anything about open FTP?


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread mike
On Tue, Mar 3, 2009 at 12:02 AM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

 Whoever said anything about open FTP?

how else do you do it?

either it's open/anonymous, or some hardcoded account info. either
way, not very secure, and due to the nature of it, kinda requires the
user to have enough privileges to upload N files of X bytes (you could
put quotas on it, chroot it, blahblah... but still)

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-03 Thread Ashley Sheridan
On Tue, 2009-03-03 at 02:20 -0800, mike wrote:
 On Tue, Mar 3, 2009 at 12:02 AM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
 
  Whoever said anything about open FTP?
 
 how else do you do it?
 
 either it's open/anonymous, or some hardcoded account info. either
 way, not very secure, and due to the nature of it, kinda requires the
 user to have enough privileges to upload N files of X bytes (you could
 put quotas on it, chroot it, blahblah... but still)
 
The way I've done it for a system at work (it is for staff and clients
only, so I guess that offers some protection) is to use scripts in
conjunction with vsftp. Accounts are managed through an admin web
interface, and each user has their own login credentials. Admittedly,
the username and password are passed as plain text for it to auto
log-in, but afaik, that happens with standard FTP anyway (unencrypted
connections). This is more than likely overkill for this situation, but
I had to resort to it as the system has to handle files over 2GB, and
file upload forms are just not meant to handle that kind of load in the
upstream!


Ash
www.ashleysheridan.co.uk


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



RE: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: mike [mailto:mike...@gmail.com]
 Sent: Monday, March 02, 2009 12:17 AM
 To: Gevorg Harutyunyan
 Cc: tedd; German Geek; php-general@lists.php.net
 Subject: Re: [PHP] www.soongy.com
 
 I have a basic demo here. The code is not at it's best, you have to
 hit reload to upload a new file.
 
 http://mikehost.com/~mike/tmp/u/
 
 It does show you though with some javascript trickery and some math
 you can derive estimated time and approximate speed. I did have an
 example of multiple files too (I don't think this one supports that)
 
 At some point I'll publish all the components required and clean it up
 nicely.
 
 I also have an nginx module to complement it that should be available
 soon, to alleviate the need for the PHP processing piece (even though
 it does work like a charm)
 
 
 On Sun, Mar 1, 2009 at 10:05 PM, Gevorg Harutyunyan
 gevorg...@gmail.com wrote:
  Thank you all for your help!
 
  I tried to do without being dependent from flash, but as I see there
 are
  only two ways for this: flash and loading without tracking
 percentage. I
  choose second way :)
 
  On Mon, Mar 2, 2009 at 1:58 AM, mike mike...@gmail.com wrote:
 
  gears will allow you to do that, more or less. i have it going...

Gears will allow you to do a lot of things. So will site-proprietary Firefox 
extensions that go well outside the realm of basic client-server interaction 
via webpages. I was under the impression that Gears requires a local 
installation of their client library in order to work.

I don't think download this new extension so you can upload files to our site 
is going to go over so well.

  On Sun, Mar 1, 2009 at 12:34 PM, tedd tedd.sperl...@gmail.com
 wrote:
   At 12:13 PM -0800 3/1/09, mike wrote:
  
   you can use gears pretty easily to make a seamless multiple file
   upload now. it's all javascript too so you can make it look how
 you
   want, behave how you want, etc. without having to buy/tweak flash
   code.
  
  
   On Sun, Mar 1, 2009 at 12:07 PM, German Geek geek...@gmail.com
 wrote:
  
    Also check this one out: google uses it in gmail:
  
    
  
   http://code.google.com/p/jquery-multifile-
 plugin/downloads/detail?name=multiple-file-upload.zipcan=2q=
  
   Understood, but I don't think either of these do what the OP
 wanted,
   whcih
   was a real time file upload progress bar.


// Todd


Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread mike
On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:

 Gears will allow you to do a lot of things. So will site-proprietary Firefox 
 extensions that go well outside the realm of basic client-server interaction 
 via webpages. I was under the impression that Gears requires a local 
 installation of their client library in order to work.

 I don't think download this new extension so you can upload files to our 
 site is going to go over so well.

Of course not, but

a) browsers don't have it built-in, yet (I was working on trying to
make a standard that I could pitch to browser creators)
b) how do you think the flash or java applets got there anyway? :)

Have a standard upload form. Tell people if they want more advanced
multi-file support, progress support, etc, etc, install Gears as well.

To me, Gears should be something just like Flash and Java... and I
think is lighter-weight and allows for extending browser capabilities
across nearly every platform without learning new languages.

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



RE: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Boyd, Todd M.
 -Original Message-
 From: mike [mailto:mike...@gmail.com]
 Sent: Monday, March 02, 2009 12:59 PM
 To: Boyd, Todd M.
 Cc: PHP General list
 Subject: Re: [PHP] upload progress (was www.soongy.com)
 
 On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:
 
  Gears will allow you to do a lot of things. So will site-proprietary
 Firefox extensions that go well outside the realm of basic client-
 server interaction via webpages. I was under the impression that Gears
 requires a local installation of their client library in order to work.
 
  I don't think download this new extension so you can upload files to
 our site is going to go over so well.
 
 Of course not, but
 
 a) browsers don't have it built-in, yet (I was working on trying to
 make a standard that I could pitch to browser creators)
 b) how do you think the flash or java applets got there anyway? :)
 
 Have a standard upload form. Tell people if they want more advanced
 multi-file support, progress support, etc, etc, install Gears as well.
 
 To me, Gears should be something just like Flash and Java... and I
 think is lighter-weight and allows for extending browser capabilities
 across nearly every platform without learning new languages.

Well it's just Javascript with access to local database storage and a caching 
facility, isn't it? I mean, I know Google threw a bunch of their API libraries 
in there with it (geolocation, for instance), but what little digging I've done 
into the matter has produced what I consider extended Javascript.

Again, I don't know a whole lot about it--I've just looked over the example 
scripts and read an article about its caching capabilities as applied to 
Wikipedia.


// Todd


Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Michael A. Peters

mike wrote:

On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:


Gears will allow you to do a lot of things. So will site-proprietary Firefox 
extensions that go well outside the realm of basic client-server interaction 
via webpages. I was under the impression that Gears requires a local 
installation of their client library in order to work.

I don't think download this new extension so you can upload files to our site 
is going to go over so well.


Of course not, but

a) browsers don't have it built-in, yet (I was working on trying to
make a standard that I could pitch to browser creators)
b) how do you think the flash or java applets got there anyway? :)

Have a standard upload form. Tell people if they want more advanced
multi-file support, progress support, etc, etc, install Gears as well.

To me, Gears should be something just like Flash and Java... and I
think is lighter-weight and allows for extending browser capabilities
across nearly every platform without learning new languages.



I don't like to install firefox extensions, I keep them to a bare 
minimum (more stable that way, less annoyances from updates to some 
extension or another being found ever session, etc) and I don't like 
sites that depend upon flash and java for functionality.


I won't install an extension just to use a specific site, I only install 
an extension if it is something I want (IE noscript - to keep your 
annoying flash from using my browsers resources).


You can do a good multi-file upload progress bar w/ the client only 
needing to allow JavaScript. In the OP's case that may mean the OP has 
to change hosts or use perl to process the upload, but here's the thing 
- if the client doesn't allow JavaScript, the upload still works fine - 
they just don't get a progress bar. You can use the same form - just use 
noscriptfoo/noscript to tell users to be patient and not hit submit 
20 zillion times.


With a flash / java based solution, you have to have different code for 
users who wisely do not allow flash and/or java, which is more work for 
you (you have to test and maintain multiple uploads) and requires the 
user to take specific action depending upon their setup.


// steps off soap box

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Nitsan Bin-Nun
I have just been wondering for the 20 zillion time why does people always
stick together 20 and zillion? you can't just use zillion times? is
that not enough for you?

On Mon, Mar 2, 2009 at 10:26 PM, Michael A. Peters mpet...@mac.com wrote:

 mike wrote:

 On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu wrote:

  Gears will allow you to do a lot of things. So will site-proprietary
 Firefox extensions that go well outside the realm of basic client-server
 interaction via webpages. I was under the impression that Gears requires a
 local installation of their client library in order to work.

 I don't think download this new extension so you can upload files to our
 site is going to go over so well.


 Of course not, but

 a) browsers don't have it built-in, yet (I was working on trying to
 make a standard that I could pitch to browser creators)
 b) how do you think the flash or java applets got there anyway? :)

 Have a standard upload form. Tell people if they want more advanced
 multi-file support, progress support, etc, etc, install Gears as well.

 To me, Gears should be something just like Flash and Java... and I
 think is lighter-weight and allows for extending browser capabilities
 across nearly every platform without learning new languages.


 I don't like to install firefox extensions, I keep them to a bare minimum
 (more stable that way, less annoyances from updates to some extension or
 another being found ever session, etc) and I don't like sites that depend
 upon flash and java for functionality.

 I won't install an extension just to use a specific site, I only install an
 extension if it is something I want (IE noscript - to keep your annoying
 flash from using my browsers resources).

 You can do a good multi-file upload progress bar w/ the client only needing
 to allow JavaScript. In the OP's case that may mean the OP has to change
 hosts or use perl to process the upload, but here's the thing - if the
 client doesn't allow JavaScript, the upload still works fine - they just
 don't get a progress bar. You can use the same form - just use
 noscriptfoo/noscript to tell users to be patient and not hit submit 20
 zillion times.

 With a flash / java based solution, you have to have different code for
 users who wisely do not allow flash and/or java, which is more work for you
 (you have to test and maintain multiple uploads) and requires the user to
 take specific action depending upon their setup.

 // steps off soap box


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




Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Michael A. Peters

Nitsan Bin-Nun wrote:
I have just been wondering for the 20 zillion time why does people 
always stick together 20 and zillion? you can't just use zillion 
times? is that not enough for you?


My server can handle 19 zillion multiple submits.

;)

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Shawn McKenzie
Nitsan Bin-Nun wrote:
 I have just been wondering for the 20 zillion time why does people always
 stick together 20 and zillion? you can't just use zillion times? is
 that not enough for you?

Actually, instead of 20 zillion I would say 2 bazillion, or .2
gazillion.  Now if I really wanted to impress, I would go for jillions,
bajillions or maybe gajillions.

Umptillion is right out...

-- 
Thanks!
-Shawn
http://www.spidean.com

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread mike
Yes you can do it with only javascript but you'll need server  
components to deal with large files ... Which the OP does not have  
access to. Post and file limits could become an issue.


Not to mention flash and java penetration is huge. I think flash is on  
something like 96% of browsers now...


Just think of how usenet, bittorrent, etc work. They split up larger  
files into smaller chunks and assemble it after. The same idea was in  
my head when I approached this.


On Mar 2, 2009, at 12:26 PM, Michael A. Peters mpet...@mac.com  
wrote:



mike wrote:
On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu  
wrote:
Gears will allow you to do a lot of things. So will site- 
proprietary Firefox extensions that go well outside the realm of  
basic client-server interaction via webpages. I was under the  
impression that Gears requires a local installation of their  
client library in order to work.


I don't think download this new extension so you can upload files  
to our site is going to go over so well.

Of course not, but
a) browsers don't have it built-in, yet (I was working on trying to
make a standard that I could pitch to browser creators)
b) how do you think the flash or java applets got there anyway? :)
Have a standard upload form. Tell people if they want more advanced
multi-file support, progress support, etc, etc, install Gears as  
well.

To me, Gears should be something just like Flash and Java... and I
think is lighter-weight and allows for extending browser capabilities
across nearly every platform without learning new languages.


I don't like to install firefox extensions, I keep them to a bare  
minimum (more stable that way, less annoyances from updates to some  
extension or another being found ever session, etc) and I don't like  
sites that depend upon flash and java for functionality.


I won't install an extension just to use a specific site, I only  
install an extension if it is something I want (IE noscript - to  
keep your annoying flash from using my browsers resources).


You can do a good multi-file upload progress bar w/ the client only  
needing to allow JavaScript. In the OP's case that may mean the OP  
has to change hosts or use perl to process the upload, but here's  
the thing - if the client doesn't allow JavaScript, the upload still  
works fine - they just don't get a progress bar. You can use the  
same form - just use noscriptfoo/noscript to tell users to be  
patient and not hit submit 20 zillion times.


With a flash / java based solution, you have to have different code  
for users who wisely do not allow flash and/or java, which is more  
work for you (you have to test and maintain multiple uploads) and  
requires the user to take specific action depending upon their setup.


// steps off soap box

--
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] upload progress (was www.soongy.com)

2009-03-02 Thread Michael A. Peters

mike wrote:
Yes you can do it with only javascript but you'll need server components 
to deal with large files ... Which the OP does not have access to. Post 
and file limits could become an issue.


Not to mention flash and java penetration is huge. I think flash is on 
something like 96% of browsers now...


And more and more people are using something like noscript to block it 
because XSS hacks are out of control. It is too easy to publish a 
website and too many web developers only care about their own data, they 
don't care about protecting users from malicious content.


That's why more and more users who have flash installed are not letting 
web sites execute it (or anything).


If you are youtube, it is reasonable to require the user have flash 
installed. Otherwise there's a good chance they won't.


I don't let a site execute flash in my browser unless I'm sure I need it 
to get what I want. Sites that code in flash that don't need to, I'm not 
going to open up myself to possible XSS exploits just because they chose 
to make their site only work when I open up my browser to vulnerabilities.


Many corporate environments are now also mandating that flash and 
javascript be disables as well because of the XSS dangers.


Use Javascript to make life easier on those who have it enabled but if 
things don't work peachy without it, you are doing it wrong.


Use flash for what really genuinely requires flash, and file upload 
isn't one of them.


Once http://people.mozilla.org/~bsterne/content-security-policy/ is 
properly implemented - I intend to only allow sites that set a 
reasonable security policy to execute anything in my browser, and I 
suspect other users will do the same. Then maybe if you have properly 
coded your site to send a content-security-policy header with reasonable 
policies I might let you use flash to upload files, assuming your policy 
specifies the source for the flash must be on your domain, but right now 
there just isn't enough client side security available to properly 
protect the users who allow execution, so educated users are very leery 
of allowing anything to run in their browser.


If I attached somefile.exe and told you to run it, would you?

Web masters who require the user to allow execution are doing just that, 
and users who allow such execution of code they know nothing about are, 
to be blundt, fools and easy targets.


// steps off soap box - permanently for awhile, I'm getting too preachy

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread Ashley Sheridan
On Mon, 2009-03-02 at 15:02 -0800, mike wrote:
 Yes you can do it with only javascript but you'll need server  
 components to deal with large files ... Which the OP does not have  
 access to. Post and file limits could become an issue.
 
 Not to mention flash and java penetration is huge. I think flash is on  
 something like 96% of browsers now...
 
 Just think of how usenet, bittorrent, etc work. They split up larger  
 files into smaller chunks and assemble it after. The same idea was in  
 my head when I approached this.
 
 On Mar 2, 2009, at 12:26 PM, Michael A. Peters mpet...@mac.com  
 wrote:
 
  mike wrote:
  On Mon, Mar 2, 2009 at 7:45 AM, Boyd, Todd M. tmbo...@ccis.edu  
  wrote:
  Gears will allow you to do a lot of things. So will site- 
  proprietary Firefox extensions that go well outside the realm of  
  basic client-server interaction via webpages. I was under the  
  impression that Gears requires a local installation of their  
  client library in order to work.
 
  I don't think download this new extension so you can upload files  
  to our site is going to go over so well.
  Of course not, but
  a) browsers don't have it built-in, yet (I was working on trying to
  make a standard that I could pitch to browser creators)
  b) how do you think the flash or java applets got there anyway? :)
  Have a standard upload form. Tell people if they want more advanced
  multi-file support, progress support, etc, etc, install Gears as  
  well.
  To me, Gears should be something just like Flash and Java... and I
  think is lighter-weight and allows for extending browser capabilities
  across nearly every platform without learning new languages.
 
  I don't like to install firefox extensions, I keep them to a bare  
  minimum (more stable that way, less annoyances from updates to some  
  extension or another being found ever session, etc) and I don't like  
  sites that depend upon flash and java for functionality.
 
  I won't install an extension just to use a specific site, I only  
  install an extension if it is something I want (IE noscript - to  
  keep your annoying flash from using my browsers resources).
 
  You can do a good multi-file upload progress bar w/ the client only  
  needing to allow JavaScript. In the OP's case that may mean the OP  
  has to change hosts or use perl to process the upload, but here's  
  the thing - if the client doesn't allow JavaScript, the upload still  
  works fine - they just don't get a progress bar. You can use the  
  same form - just use noscriptfoo/noscript to tell users to be  
  patient and not hit submit 20 zillion times.
 
  With a flash / java based solution, you have to have different code  
  for users who wisely do not allow flash and/or java, which is more  
  work for you (you have to test and maintain multiple uploads) and  
  requires the user to take specific action depending upon their setup.
 
  // steps off soap box
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
There are a lot of free FTP Java applets out there, which you could
easily integrate with a web page and your hosting. You'll have the
advantage of a familiar interface, multiple uploads, queues, and
progress bars. Worst case scenario, user has no Java and you have to
offer a standard upload form.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread mike
On Mon, Mar 2, 2009 at 3:29 PM, Ashley Sheridan
a...@ashleysheridan.co.uk wrote:

 There are a lot of free FTP Java applets out there, which you could
 easily integrate with a web page and your hosting. You'll have the
 advantage of a familiar interface, multiple uploads, queues, and
 progress bars. Worst case scenario, user has no Java and you have to
 offer a standard upload form.

since it's java, you're getting into Michael's infinite paranoia soapbox... :)

also it requires FTP credentials, or an FTP account, which makes life
a living hell. firewalls, NATted setups, people finding out it's an
open FTP, etc.

If you are requiring an applet, I don't see why there is even a
discussion. Go with Gears, no extra server code or configuration
necessary.

If you are anti-applet, you'll still need javascript, and depending on
the file sizes you're dealing with, you'll need to modify the server
configuration (which is out of a lot of people's control)

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



Re: [PHP] upload progress (was www.soongy.com)

2009-03-02 Thread mike
On Mon, Mar 2, 2009 at 3:25 PM, Michael A. Peters mpet...@mac.com wrote:

 And more and more people are using something like noscript to block it
 because XSS hacks are out of control. It is too easy to publish a website
 and too many web developers only care about their own data, they don't care
 about protecting users from malicious content.

More and more ... yes, a handful a day. The vast majority of users
don't. Just like people going insane about cookie security. It's the
uninformed and paranoid spreading FUD. I have Javascript, Java, Flash
and Gears all enabled on my browsers - I have zero issues. I enjoy the
capabilities that Flash and Gears add too, and nowadays almost every
website relies on Javascript for something.

 That's why more and more users who have flash installed are not letting web
 sites execute it (or anything).

Got some stats/URLs for this?

 If you are youtube, it is reasonable to require the user have flash
 installed. Otherwise there's a good chance they won't.

Interesting. Flash has a 96% or some sort penetration, and it is not
usually based on a per-site basis. Why is youtube the only site
someone would allow Flash on? More and more websites are turning to
rich media, with Flash being the defacto standard. Go to almost any
major website, and if the content itself doesn't have Flash mixed in,
the banner ads and other functionality does.

 I don't let a site execute flash in my browser unless I'm sure I need it to
 get what I want. Sites that code in flash that don't need to, I'm not going
 to open up myself to possible XSS exploits just because they chose to make
 their site only work when I open up my browser to vulnerabilities.

Only the paranoid survive... I also don't drive on days ending with
y because of the chance of an automobile accident.

 Many corporate environments are now also mandating that flash and javascript
 be disables as well because of the XSS dangers.

Funny, I work for a fortune 50 company and Java is mandatory on our
machines due to the intranet applications which require applet
support.

 Use Javascript to make life easier on those who have it enabled but if
 things don't work peachy without it, you are doing it wrong.

Gears is basically extensiosn to Javascript with some security baked
in... so thank you for further reiterating my point.

 Use flash for what really genuinely requires flash, and file upload isn't
 one of them.

Agreed. It's just another applet option. Just like ActiveX or Java.

 If I attached somefile.exe and told you to run it, would you?

 Web masters who require the user to allow execution are doing just that, and
 users who allow such execution of code they know nothing about are, to be
 blundt, fools and easy targets.

Last I checked, Flash applets aren't very insecure. Java is a bit
easier. ActiveX is very easy.

It's all about the installation and the user.

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



Re: [PHP] upload file problem

2008-07-31 Thread Eric Butera
On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
[EMAIL PROTECTED] wrote:
 I'm trying to upload the file. It's showing me successfully uploaded.
 But it's not able to move from temp directory to my defined directory

 my code:

 if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
 } else {
  echo File uploading error;
 }

 Thanks in advance.

 -Jignesh

Is the directory you're moving to writable by your web server?  If you
don't know, try making a separate script that tries
var_dump(is_writable('/path/to/uploads'));

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



Re: [PHP] upload file problem

2008-07-31 Thread Jignesh Thummar
it's writable.

On Thu, Jul 31, 2008 at 3:37 PM, Eric Butera [EMAIL PROTECTED] wrote:
 On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
 [EMAIL PROTECTED] wrote:
 I'm trying to upload the file. It's showing me successfully uploaded.
 But it's not able to move from temp directory to my defined directory

 my code:

 if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
 } else {
  echo File uploading error;
 }

 Thanks in advance.

 -Jignesh

 Is the directory you're moving to writable by your web server?  If you
 don't know, try making a separate script that tries
 var_dump(is_writable('/path/to/uploads'));


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



Re: [PHP] upload file problem

2008-07-31 Thread Micah Gersten
Maybe check the return value of the function:
http://us3.php.net/manual/en/function.move-uploaded-file.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Jignesh Thummar wrote:
 I'm trying to upload the file. It's showing me successfully uploaded.
 But it's not able to move from temp directory to my defined directory

 my code:

 if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
 } else {
  echo File uploading error;
 }

 Thanks in advance.

 -Jignesh

   

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



Re: [PHP] upload file problem

2008-07-31 Thread Daniel Brown
On Thu, Jul 31, 2008 at 10:18 AM, Jignesh Thummar
[EMAIL PROTECTED] wrote:
 I'm trying to upload the file. It's showing me successfully uploaded.
 But it's not able to move from temp directory to my defined directory

 my code:

 if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
 } else {
  echo File uploading error;
 }

If it is passing the if(is_uploaded_file()) condition, echo out
$myfilename and make sure it's valid to use as a path/filename.

-- 
/Daniel P. Brown
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

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



Re: [PHP] upload file problem

2008-07-31 Thread brian

Jignesh Thummar wrote:

I'm trying to upload the file. It's showing me successfully uploaded.
But it's not able to move from temp directory to my defined directory

my code:

if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
} else {
 echo File uploading error;
}



What does $myfilename resolve to? It should include the complete path 
from server root (not DOCUMENT_ROOT).


Try:

echo File uploading error: ${myfilename};

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



Re: [PHP] upload file problem

2008-07-31 Thread Jignesh Thummar
Thanks.. It's fixed...

- Jignesh

On Thu, Jul 31, 2008 at 6:05 PM, brian [EMAIL PROTECTED] wrote:
 Jignesh Thummar wrote:

 I'm trying to upload the file. It's showing me successfully uploaded.
 But it's not able to move from temp directory to my defined directory

 my code:

 if (is_uploaded_file($_FILES['myfile']['tmp_name'])) {
   move_uploaded_file($_FILES['myfile']['tmp_name'], $myfilename);
   echo File . $_FILES['myfile']['name'] . uploaded successfully.\n;
 } else {
  echo File uploading error;
 }


 What does $myfilename resolve to? It should include the complete path from
 server root (not DOCUMENT_ROOT).

 Try:

 echo File uploading error: ${myfilename};

 --
 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] upload issue

2008-02-17 Thread Børge Holen
On Sunday 17 February 2008 19:22:03 nihilism machine wrote:
 any idea why this fails?this is the error: Sorry, there was a problem
 uploading your file

 ?php

 require_once(classes/db.class.php);

 $target = ;
 $fileName = basename( $_FILES['uploaded']['name']);
 $extension = strtolower(strrchr($fileName,.));
 $DB = new DB();
 $insertID = $DB-insert_sql(INSERT INTO CMS_Media (File_Name) VALUES
 (''));
 $target = media/ . $insertID . $extension;
 //echo $target;
 if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
   // Error
   echo File was uploaded!;
 } else {
   echo Sorry, there was a problem uploading your file.;
 }

 chmod($target, 0755);

 header(Location: crop.php?imageName=$newFileName);

 ?


This looks weird. is this actually anything: $_FILES['uploaded']['tmp_name']. 
I always used $_FILES['tmp_name'], $_FILES['name'] and such




 ---
 Edward H. Hotchkiss
 Chief Technical Officer
 Durgle, INC
 [EMAIL PROTECTED]
 http://www.durgle.com
 ---



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] upload issue

2008-02-17 Thread Chris

nihilism machine wrote:
any idea why this fails?this is the error: Sorry, there was a problem 
uploading your file


It can't move the file to the $target location, or maybe the file wasn't 
uploaded properly in the first place.


What's in $_FILES['uploaded']['error'] ?

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


if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
// Error
echo File was uploaded!;
} else {
echo Sorry, there was a problem uploading your file.;
}

chmod($target, 0755);


Files do not need to be 0755, they should be 0644 unless you want them 
to actually run something (eg they are a shell script or perl script 
that you'd run from the cmd line).


--
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] upload issue

2008-02-17 Thread Chris

Børge Holen wrote:

On Sunday 17 February 2008 19:22:03 nihilism machine wrote:

any idea why this fails?this is the error: Sorry, there was a problem
uploading your file

?php

require_once(classes/db.class.php);

$target = ;
$fileName = basename( $_FILES['uploaded']['name']);
$extension = strtolower(strrchr($fileName,.));
$DB = new DB();
$insertID = $DB-insert_sql(INSERT INTO CMS_Media (File_Name) VALUES
(''));
$target = media/ . $insertID . $extension;
//echo $target;
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
// Error
echo File was uploaded!;
} else {
echo Sorry, there was a problem uploading your file.;
}

chmod($target, 0755);

header(Location: crop.php?imageName=$newFileName);

?



This looks weird. is this actually anything: $_FILES['uploaded']['tmp_name']. 
I always used $_FILES['tmp_name'], $_FILES['name'] and such


According to php docs it's always a multi-dimensional array:
http://www.php.net/manual/en/features.file-upload.php

The 'uploaded' is what you call the file input in your form.

--
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] upload issue

2008-02-17 Thread Børge Holen
On Monday 18 February 2008 00:59:31 Chris wrote:
 Børge Holen wrote:
  On Sunday 17 February 2008 19:22:03 nihilism machine wrote:
  any idea why this fails?this is the error: Sorry, there was a problem
  uploading your file
 
  ?php
 
  require_once(classes/db.class.php);
 
  $target = ;
  $fileName = basename( $_FILES['uploaded']['name']);
  $extension = strtolower(strrchr($fileName,.));
  $DB = new DB();
  $insertID = $DB-insert_sql(INSERT INTO CMS_Media (File_Name) VALUES
  (''));
  $target = media/ . $insertID . $extension;
  //echo $target;
  if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
 // Error
 echo File was uploaded!;
  } else {
 echo Sorry, there was a problem uploading your file.;
  }
 
  chmod($target, 0755);
 
  header(Location: crop.php?imageName=$newFileName);
 
  ?
 
  This looks weird. is this actually anything:
  $_FILES['uploaded']['tmp_name']. I always used $_FILES['tmp_name'],
  $_FILES['name'] and such

 According to php docs it's always a multi-dimensional array:
 http://www.php.net/manual/en/features.file-upload.php

 The 'uploaded' is what you call the file input in your form.

oh well, as long as it works for me, thanks for the info


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



-- 
---
Børge Holen
http://www.arivene.net

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



Re: [PHP] upload issue

2008-01-23 Thread Richard Lynch
On Wed, January 23, 2008 6:55 pm, nihilism machine wrote:
 i am using this code on my form page:

 form action=uploadAd2.php enctype=multipart/form-data
 method=post name=adForm id=adForm
 input type=hidden name=donorID value=?php echo $_GET['ID']; ?
   /
 input type=hidden name=MAX_FILE_SIZE value=30 /
 input type=file name=upload1 /
 input type=image src=admin/images/next.png name=Submit
 alt=Submit Form /



 my upload code is below:


 $uploaddir = 'admin/advertisements/';
 $uploadfileTmp = basename($_FILES['upload1']['name']);
 $uploadfile = $uploaddir . basename($_FILES['upload1']['name']);
 if (move_uploaded_file($_FILES['upload1']['tmp_name'], $uploadfile)) {
   $FileName = $uploadfileTmp;
 } else {
   echo Error!;
   exit();
 }





 my error is:


 Internal Server Error

 The server encountered an internal error or misconfiguration and was
 unable to complete your request.

 Please contact the server administrator, [EMAIL PROTECTED] and
 inform them of the time the error occurred, and anything you might
 have done that may have caused the error.

 More information about this error may be available in the server error
 log.

Check the error_log of Apache.

It will almost certainly have more info.

You'll have to cause the error again or know the time when it happened
to find the error.

You should also make sure plain simple pages like ?php phpinfo()?
work as expected.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/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] upload problem

2008-01-22 Thread Casey
On Jan 22, 2008, at 5:01 PM, nihilism machine  
[EMAIL PROTECTED] wrote:



any ideas why this does not work?


class upload {

   function upload() {
   upload::uploader();
   }

   function uploader() {
   $FileName = basename($_FILES['upload1']['name']);
   if (move_uploaded_file($_FILES['upload1']['tmp_name'],  
$FileName)) {

   chmod($FileName, 0755);
   rename($FileName, admin/advertisements/ . $FileName);
   return $FileName;
   } else {
   return Error!;
   }
   }
}


Try deleting the upload() function. Then:

$test = new upload();
$filename = test-uploader();

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



Re: [PHP] upload problem

2008-01-22 Thread Daniel Brown
On Jan 22, 2008 8:01 PM, nihilism machine [EMAIL PROTECTED] wrote:
 any ideas why this does not work?


 class upload {

 function upload() {
 upload::uploader();
 }

 function uploader() {
 $FileName = basename($_FILES['upload1']['name']);
 if (move_uploaded_file($_FILES['upload1']['tmp_name'], 
 $FileName)) {
 chmod($FileName, 0755);
 rename($FileName, admin/advertisements/ . 
 $FileName);
 return $FileName;
 } else {
 return Error!;
 }
 }
 }

What do you mean doesn't work?  Does it hit the Error! return,
does it do nothing, does it come up with a build error?  If you're
more specific, you'll get better responses and quicker help.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek and #1 Rated Year's Coolest Guy By Self Since
Nineteen-Seventy-[mumble].

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



Re: [PHP] upload problem

2008-01-22 Thread Chris

nihilism machine wrote:

any ideas why this does not work?


1) the field in the form might not be 'upload1'.
2) the file is too big to upload ( max_upload_size)
3) the /tmp folder might not be writable or full
4) the folder you're trying to write into is not writable (or the drive 
is full)

5) the rename might not work (same reasons as above)
6) the chmod might fail

that'll do for starters :)

add

error_reporting(E_ALL);
and
ini_set('display_errors', true);

in your script and see what's going on.


instead of doing a move-uploaded-file then a rename, combine them:

$destination = 'admin/advertisements/' . 
basename($_FILES['upload1']['name']);


if (move_uploaded_file($src, $destination)) {
...
}
...

--
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] upload temp dir in vhost env.

2007-08-26 Thread brian

jekillen wrote:

Hello again;

I have a question about  upload temp dir as defined in php.ini;

I have been working on a project that has registered users, each having
a user space portion of the web site file system. I want them to be
able to upload images and such and have the stuff transfered to their
own user spaces. With one up load temp dir designated, how do I
insure that the uploaded files get to the correct destination?
Or, is it possible to designate more than one up load temp dir in
php.ini. (that would be the best solution)
This situation is not a virtual host environment, but one site that
will be using ssl.


No, the best solution is for your application to grab the path to that 
particular user's directory and assign a unique name to the uploaded 
file, then move it from the temp dir:


move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_path);

where 'upload_file' is the name of your upload form field.

http://www.php.net/manual/en/function.move-uploaded-file.php


I am using Apache on unix based host and am aware that php
assigns a temp name to files that are uploaded, but if different
users are uploading files concurrently, there could be a confusion
as to where each file should be transfered to.


That's unlikely to occur. In fact, i'd be surprised if it were possible 
that PHP would assign a temp name that already existed.


brian

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



Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread Ludovic André

Hi,

that's not a problem to specify where the uploaded file has to be moved 
after upload.  As you specify for each user a personal directory in the 
system, you just need to use a function like move_uploaded_file() to 
move the uploaded file to this directory.  Each uploaded file goes to, 
let's say, /tmp (the directory specified in your php config), and 
inherits from a unique filename.  This filename is contained in the 
$_FILES array available in the script which handles the upload. So if 
you have a form containing a file upload field called file, you can 
retrieve the filename of the newly uploaded file using: 
$_FILES['file']['tmp_name'] (if the upload went successfully).

You can then simply use:
move_uploaded_file( $_FILES['file']['tmp_name'], 
'/path/to/user/personal/dir');


This will work even if multiple users are uploading a file at the same 
time, as the $_FILES array will contain the info related to a single user.


I hope I've been clear enough...

Ludo

Hello again;

I have a question about  upload temp dir as defined in php.ini;

I have been working on a project that has registered users, each having
a user space portion of the web site file system. I want them to be
able to upload images and such and have the stuff transfered to their
own user spaces. With one up load temp dir designated, how do I
insure that the uploaded files get to the correct destination?
Or, is it possible to designate more than one up load temp dir in
php.ini. (that would be the best solution)
This situation is not a virtual host environment, but one site that
will be using ssl.
I am using Apache on unix based host and am aware that php
assigns a temp name to files that are uploaded, but if different
users are uploading files concurrently, there could be a confusion
as to where each file should be transfered to.
I do not know where else to look for an answer to this question
at present.
Any knowledgeable response appreciated.
Thanks in advance:
Jeff K.



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



Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread Richard Lynch
On Sun, August 26, 2007 10:34 am, jekillen wrote:
 I have been working on a project that has registered users, each
 having
 a user space portion of the web site file system. I want them to be
 able to upload images and such and have the stuff transfered to their
 own user spaces. With one up load temp dir designated, how do I
 insure that the uploaded files get to the correct destination?

http://php.net/move_uploaded_file

And, BEFORE you move it, you should Validate the uploaded file as many
ways as practical for your web application.

 I am using Apache on unix based host and am aware that php
 assigns a temp name to files that are uploaded, but if different
 users are uploading files concurrently, there could be a confusion
 as to where each file should be transfered to.

The user uploading the file is probably logged in, and you probably
have some kind of user_id or Profile and can decide where to move the
file based on that user's identity.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] upload temp dir in vhost env.

2007-08-26 Thread jekillen


On Aug 26, 2007, at 9:15 AM, brian wrote:


jekillen wrote:

Hello again;
I have a question about  upload temp dir as defined in php.ini;
I have been working on a project that has registered users, each 
having

a user space portion of the web site file system. I want them to be
able to upload images and such and have the stuff transfered to their
own user spaces. With one up load temp dir designated, how do I
insure that the uploaded files get to the correct destination?
Or, is it possible to designate more than one up load temp dir in
php.ini. (that would be the best solution)
This situation is not a virtual host environment, but one site that
will be using ssl.


No, the best solution is for your application to grab the path to that 
particular user's directory and assign a unique name to the uploaded 
file, then move it from the temp dir:


move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_path);

where 'upload_file' is the name of your upload form field.

http://www.php.net/manual/en/function.move-uploaded-file.php


I am using Apache on unix based host and am aware that php
assigns a temp name to files that are uploaded, but if different
users are uploading files concurrently, there could be a confusion
as to where each file should be transfered to.


That's unlikely to occur. In fact, i'd be surprised if it were 
possible that PHP would assign a temp name that already existed.


brian



Thanks thats all I need to know.
Jeff K

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



Re: [PHP] upload temp dir in vhost env.

2007-08-26 Thread jekillen


On Aug 26, 2007, at 2:56 PM, Richard Lynch wrote:


On Sun, August 26, 2007 10:34 am, jekillen wrote:

I have been working on a project that has registered users, each
having
a user space portion of the web site file system. I want them to be
able to upload images and such and have the stuff transfered to their
own user spaces. With one up load temp dir designated, how do I
insure that the uploaded files get to the correct destination?


http://php.net/move_uploaded_file

And, BEFORE you move it, you should Validate the uploaded file as many
ways as practical for your web application.


Yes, I agree, I want to completely decontaminate all uploaded files but 
I

am not sure of a system that will do that.
like embedding scripts in image files, binary files, encrypted images
(I forgot the term for that, stegonography or something), shell
escape chars, incompatible files, viruses, erroneous mime or file types,
you name it, I want to check it out before it is a problem.
JK



I am using Apache on unix based host and am aware that php
assigns a temp name to files that are uploaded, but if different
users are uploading files concurrently, there could be a confusion
as to where each file should be transfered to.


The user uploading the file is probably logged in, and you probably
have some kind of user_id or Profile and can decide where to move the
file based on that user's identity.


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



Re: [PHP] Upload and resize file

2007-08-23 Thread Craige Leeder
While I'm not 100% sure, I'd say something's wrong with this line:

system(pnmscale -xy 250 200 $tmpimg | cjpeg -smoo 10 -qual 50
$imgfile);

I would say that Linux is not writing the output to the location
stored in $imgfile, and thus there is no file there to delete.
However, I can not really be sure. Can someone support or deny this
claim?

- Craige

On 8/22/07, Beauford [EMAIL PROTECTED] wrote:
 I downloaded this 'upload and resize image' script, and since I have no idea
 what I am looking at as this is something I have never done, could someone
 have a look and see what the problem might be.  I've been searching around
 but haven't come across anything that makes any sense yet.

 When a picture needs to be resized I am getting the following error. If it
 is the same size or under I don't get this error.

 Warning: unlink() [function.unlink]: No such file or directory in
 /usr/local/apache/htdocs/website/upload.php on line 92

 The full code is below.

 Thanks

 --

 html

 head
 titleweb.blazonry : PHP : Upload and Resize an Image/title

 ?php

 if ($_SERVER['REQUEST_METHOD'] == POST)
 {

 /* SUBMITTED INFORMATION - use what you need
  * temporary filename (pointer): $imgfile
  * original filename   : $imgfile_name
  * size of uploaded file   : $imgfile_size
  * mime-type of uploaded file  : $imgfile_type
  */

  /*== upload directory where the file will be stored
   relative to where script is run ==*/

 $uploaddir = images;


 /*== get file extension (fn at bottom of script) ==*/
 /*== checks to see if image file, if not do not allow upload ==*/
 $pext = getFileExtension($imgfile_name);
 $pext = strtolower($pext);
 if (($pext != jpg)   ($pext != jpeg))
 {
 print h1ERROR/h1Image Extension Unknown.br;
 print pPlease upload only a JPEG image with the extension .jpg or
 .jpeg ONLYbrbr;
 print The file you uploaded had the following extension:
 $pext/p\n;

 /*== delete uploaded file ==*/
 unlink($imgfile);
 exit();
 }


 //-- RE-SIZING UPLOADED IMAGE

 /*== only resize if the image is larger than 250 x 200 ==*/
 $imgsize = GetImageSize($imgfile);

 /*== check size  0=width, 1=height ==*/
 if (($imgsize[0]  250) || ($imgsize[1]  200))
 {
 /*== temp image file -- use tempnam() to generate the temp
  file name. This is done so if multiple people access the
 script at once they won't ruin each other's temp file ==*/
 $tmpimg = tempnam(/tmp, MKUP);

 /*== RESIZE PROCESS
  1. decompress jpeg image to pnm file (a raw image type)
  2. scale pnm image
  3. compress pnm file to jpeg image
 ==*/

 /*== Step 1: djpeg decompresses jpeg to pnm ==*/
 system(djpeg $imgfile $tmpimg);


 /*== Steps 23: scale image using pnmscale and then
  pipe into cjpeg to output jpeg file ==*/
 system(pnmscale -xy 250 200 $tmpimg | cjpeg -smoo 10 -qual 50
 $imgfile);

 /*== remove temp image ==*/
 unlink($tmpimg);

 }

 /*== setup final file location and name ==*/
 /*== change spaces to underscores in filename  ==*/
 $final_filename = str_replace( , _, $imgfile_name);
 $newfile = $uploaddir . /$final_filename;

 /*== do extra security check to prevent malicious abuse==*/
 if (is_uploaded_file($imgfile))
 {

/*== move file to proper directory ==*/
if (!copy($imgfile,$newfile))
{
   /*== if an error occurs the file could not
be written, read or possibly does not exist ==*/
   print Error Uploading File.;
   exit();
}
  }

 /*== delete the temporary uploaded file ==*/
unlink($imgfile);


 print(img src=\images\\$final_filename\);

 /*== DO WHATEVER ELSE YOU WANT
  SUCH AS INSERT DATA INTO A DATABASE  ==*/

 }
 ?


 /head
 body bgcolor=#FF

 h2Upload and Resize an Image/h2

 form action=?php echo $_SERVER['PHP_SELF']; ? method=POST
 enctype=multipart/form-data
 input type=hidden name=MAX_FILE_SIZE value=5

 pUpload Image: input type=file name=imgfilebr
 font size=1Click browse to upload a local file/fontbr
 br
 input type=submit value=Upload Image
 /form

 /body
 /html

 ?php
 /*== FUNCTIONS ==*/

 function getFileExtension($str) {

 $i = strrpos($str,.);
 if (!$i) { return ; }

 $l = strlen($str) - $i;
 $ext = substr($str,$i+1,$l);

 return $ext;

 }
 ?

 --
 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] Upload and resize file

2007-08-23 Thread brian

Beauford wrote:

I downloaded this 'upload and resize image' script, and since I have no idea
what I am looking at as this is something I have never done, could someone
have a look and see what the problem might be.  I've been searching around
but haven't come across anything that makes any sense yet.

When a picture needs to be resized I am getting the following error. If it
is the same size or under I don't get this error.

Warning: unlink() [function.unlink]: No such file or directory in
/usr/local/apache/htdocs/website/upload.php on line 92



I see at least 3 places where unlink() is called. Which one is at line 
92? Knowing that will go along way toward understanding where the script 
has gotten to and what else might be going wrong.


You should place some print statements in the script just before each 
unlink() call. Something like:


print 'first one';
print $tmpimg';
unlink($tmpimg);

...

print 'second one';
print $tmpimg';
unlink($tmpimg);

etc.

This way you'll be able to at least see what is in the var $tmpimg.

brian

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



Re: [PHP] Upload and resize file

2007-08-23 Thread Børge Holen
On Thursday 23 August 2007 03:41, Beauford wrote:
 I downloaded this 'upload and resize image' script, and since I have no
 idea what I am looking at as this is something I have never done, could
 someone have a look and see what the problem might be.  I've been searching
 around but haven't come across anything that makes any sense yet.

 When a picture needs to be resized I am getting the following error. If it
 is the same size or under I don't get this error.

 Warning: unlink() [function.unlink]: No such file or directory in
 /usr/local/apache/htdocs/website/upload.php on line 92

This full code of yours should be no more than 7 lines. However, delete line 
92, it's not needed to make the script actually upload stuff. 
You should have a file like php12312 file name or similar at the default 
upload path defined in php.ini. This file is the $_file['tmp_name'] within 
the $files array, so while at it; don't make use of a $formname for 
everything. 
If you make use of the $_files['array'] stuff the code would be so much more 
manageable within the linux os.

If the temp file does not occur; you got the netpbm and djpeg installed?

Not sure about making this sort of things work under a windows system, but on 
linux its a sundaysprawl


 The full code is below.

 Thanks

 --

 html

 head
 titleweb.blazonry : PHP : Upload and Resize an Image/title

 ?php

 if ($_SERVER['REQUEST_METHOD'] == POST)
 {

 /* SUBMITTED INFORMATION - use what you need
  * temporary filename (pointer): $imgfile
  * original filename   : $imgfile_name
  * size of uploaded file   : $imgfile_size
  * mime-type of uploaded file  : $imgfile_type
  */

  /*== upload directory where the file will be stored
   relative to where script is run ==*/

 $uploaddir = images;


 /*== get file extension (fn at bottom of script) ==*/
 /*== checks to see if image file, if not do not allow upload ==*/
 $pext = getFileExtension($imgfile_name);
 $pext = strtolower($pext);
 if (($pext != jpg)   ($pext != jpeg))
 {
 print h1ERROR/h1Image Extension Unknown.br;
 print pPlease upload only a JPEG image with the extension .jpg
 or .jpeg ONLYbrbr;
 print The file you uploaded had the following extension:
 $pext/p\n;

 /*== delete uploaded file ==*/
 unlink($imgfile);
 exit();
 }


 //-- RE-SIZING UPLOADED IMAGE

 /*== only resize if the image is larger than 250 x 200 ==*/
 $imgsize = GetImageSize($imgfile);

 /*== check size  0=width, 1=height ==*/
 if (($imgsize[0]  250) || ($imgsize[1]  200))
 {
 /*== temp image file -- use tempnam() to generate the temp
  file name. This is done so if multiple people access the
 script at once they won't ruin each other's temp file ==*/
 $tmpimg = tempnam(/tmp, MKUP);

 /*== RESIZE PROCESS
  1. decompress jpeg image to pnm file (a raw image type)
  2. scale pnm image
  3. compress pnm file to jpeg image
 ==*/

 /*== Step 1: djpeg decompresses jpeg to pnm ==*/
 system(djpeg $imgfile $tmpimg);


 /*== Steps 23: scale image using pnmscale and then
  pipe into cjpeg to output jpeg file ==*/
 system(pnmscale -xy 250 200 $tmpimg | cjpeg -smoo 10 -qual 50

 $imgfile);

 /*== remove temp image ==*/
 unlink($tmpimg);

 }

 /*== setup final file location and name ==*/
 /*== change spaces to underscores in filename  ==*/
 $final_filename = str_replace( , _, $imgfile_name);
 $newfile = $uploaddir . /$final_filename;

 /*== do extra security check to prevent malicious abuse==*/
 if (is_uploaded_file($imgfile))
 {

/*== move file to proper directory ==*/
if (!copy($imgfile,$newfile))
{
   /*== if an error occurs the file could not
be written, read or possibly does not exist ==*/
   print Error Uploading File.;
   exit();
}
  }

 /*== delete the temporary uploaded file ==*/
unlink($imgfile);


 print(img src=\images\\$final_filename\);

 /*== DO WHATEVER ELSE YOU WANT
  SUCH AS INSERT DATA INTO A DATABASE  ==*/

 }
 ?


 /head
 body bgcolor=#FF

 h2Upload and Resize an Image/h2

 form action=?php echo $_SERVER['PHP_SELF']; ? method=POST
 enctype=multipart/form-data
 input type=hidden name=MAX_FILE_SIZE value=5

 pUpload Image: input type=file name=imgfilebr
 font size=1Click browse to upload a local file/fontbr
 br
 input type=submit value=Upload Image
 /form

 /body
 /html

 ?php
 /*== FUNCTIONS ==*/

 function getFileExtension($str) {

 $i = strrpos($str,.);
 if (!$i) { return ; }

 $l = strlen($str) - $i;
 $ext = substr($str,$i+1,$l);

 return $ext;

   

Re: [PHP] Upload Tracker.

2007-07-17 Thread Tanner Postert

i use a program called upload progress meter, it can be downloaded here:

http://pdoru.from.ro/upload-progress-meter/

I just wrote an ajax function to return the % of the download, and filled a
div on each upload. It depends on how often you poll for the %, but most
likely it won't be a smooth transition from 0-100% it will jump, 0, 12, 28,
38, 52, 71, 88, 92, 100, or something similar.

you will have to phpize the function and install it as a dynamic module, but
it works for me.

hope this helps.

On 7/17/07, Tom Ray [Lists] [EMAIL PROTECTED] wrote:


I'm a little unsure on how to do this but basically when someone uses a
form to upload a file I want to have a popup window come up and so the
process in percentage of the transfer.  Anyone do this before? Is it
possible in PHP or do I need to do it in javascript or a mixture of both?

Any suggestions, ideas, commands or functions to try to use? I would
greatly appreciate it.

Thanks!

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




Re: [PHP] Upload Tracker.

2007-07-17 Thread Paul Novitski

At 7/17/2007 11:46 AM, Tom Ray [Lists] wrote:
I'm a little unsure on how to do this but basically when someone 
uses a form to upload a file I want to have a popup window come up 
and so the process in percentage of the transfer.  Anyone do this 
before? Is it possible in PHP or do I need to do it in javascript or 
a mixture of both?



Upload progress can't be reported using PHP alone, but here's a 
PHP-perl amalgam you can check out:


Mega Upload
http://www.raditha.com/php/progress.php

I haven't used it can can't vouch for it.  When I tried their demo it 
failed but I think for reasons other than the functionality of the 
widget itself.


Paul 


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



Re: [PHP] Upload Tracker.

2007-07-17 Thread Richard Lynch
On Tue, July 17, 2007 1:46 pm, Tom Ray [Lists] wrote:
 I'm a little unsure on how to do this but basically when someone uses
 a
 form to upload a file I want to have a popup window come up and so the
 process in percentage of the transfer.  Anyone do this before? Is it
 possible in PHP or do I need to do it in javascript or a mixture of
 both?

 Any suggestions, ideas, commands or functions to try to use? I would
 greatly appreciate it.

For this to be a PHP question, you need PHP 5.2 (?) and the new file
upload hook that it supplies.

Otherwise, it's a Javascript/Ajax feature, with PHP being relegated to
not doing much of anything about the progress meter.

Why the BROWSER doesn't provide this feature everybody wants is beyond
my ken...

Surely the browser has some clue how many bytes are uploaded and how
big the file was.

How tricky could it be for Firefox/IE to poke those values into a
couple variables somewhere?

Instead we have a zillion JS hacks by developers generating tons of
traffic back-n-forth to the server to ask it how many bytes it has
received so far...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] Upload a ppt file

2007-05-29 Thread tedd

At 11:07 PM +0200 5/28/07, Tijnema wrote:

On 5/28/07, tedd [EMAIL PROTECTED] wrote:

Hi Gang:

I can upload a text file and an image file via a html form, but I am
having problems uploading a PowerPoint file. Apparently, that's a
different critter.



Duh!

Thanks for the hints -- it was stupid mistake on my part that. 
Sometimes you can get too carried away with trying to make things 
secure.


It works fine now that I let it work.

Cheers,

tedd
--
---
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] Upload a ppt file

2007-05-28 Thread Tijnema

On 5/28/07, tedd [EMAIL PROTECTED] wrote:

Hi Gang:

I can upload a text file and an image file via a html form, but I am
having problems uploading a PowerPoint file. Apparently, that's a
different critter.

Does any have any references or an example to show me?

Thanks,

Cheers,

tedd


It should work with the same form you used for image  text files, but
make sure you still have enctype set to multipart/form-data.
Also, like Jared said, make sure it isn't limited by any option, this
could be the upload filesize limit, but also memory limit if you were
planning to upload big files :)

Tijnema

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



[PHP] Re: php upload files

2007-05-23 Thread itoctopus
As far as I remember, IIS used to have a reserved user that it ran all its 
actions under.
All you have to do is to give this user the necessary permissions (I 
remember the username started with I).

Here's a link that might help : http://support.microsoft.com/kb/812614

-- 
itoctopus - http://www.itoctopus.com
kats Ant [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
Hi all a i am running a windows 2003 server with IIS. I have created a php 
script that uploads a file to a server.

in the server i have users and a user1 has permission to folder1, user2 has 
permissions to folder2. I want an administrator to run the script and upload 
a file to these foldes. how can the script access the folders that only 
various users have access?
_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+worldmkt=en-USform=QBRE 

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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 11:30 am, Eric Trahan wrote:

 The upload work.  The user file is uploaded to my destination folder
 (page5/) but the file is unreadable and the file size is smaller than
 the original file size.

 $tmp_name = $_FILES['uneimage']['tmp_name'];
 $type = $_FILES['uneimage']['type'];
 $name = $_FILES['uneimage']['name'];
 $size = $_FILES['uneimage']['size'];

$error = $_FILES['uneimage']['error'];
switch($error){
  //There are at least 5 or 6 'case' statements that go here
  //read the manual to find them
}

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] Upload problem - final size is different

2007-05-08 Thread Eric Trahan

$error = $_FILES['uneimage']['error'];

That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.


And the function move_uploaded_file($_FILES['uneimage']['tmp_name'],  
$target_path) returns TRUE, so the upload work (in a way !).


The problem is the file that is upload doesn't match the original file.

Eric.


Le 2007-05-08 à 14:04, Richard Lynch a écrit :


On Tue, May 8, 2007 11:30 am, Eric Trahan wrote:


The upload work.  The user file is uploaded to my destination folder
(page5/) but the file is unreadable and the file size is smaller than
the original file size.



$tmp_name = $_FILES['uneimage']['tmp_name'];
$type = $_FILES['uneimage']['type'];
$name = $_FILES['uneimage']['name'];
$size = $_FILES['uneimage']['size'];


$error = $_FILES['uneimage']['error'];
switch($error){
  //There are at least 5 or 6 'case' statements that go here
  //read the manual to find them
}

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] Upload problem - final size is different

2007-05-08 Thread Richard Davey

Eric Trahan wrote:


$error = $_FILES['uneimage']['error'];

That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.


It just means there wasn't an error.

And the function move_uploaded_file($_FILES['uneimage']['tmp_name'], 
$target_path) returns TRUE, so the upload work (in a way !).


The problem is the file that is upload doesn't match the original file.


By how much is the difference? Are we talking a few bytes, a few 
megabytes, what?


If you then download the file again, is it corrupted, or does it work?

Cheers,

Rich
--
Zend Certified Engineer
http://www.corephp.co.uk

Never trust a computer you can't throw out of a window

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



Re: [PHP] Upload problem - final size is different

2007-05-08 Thread Richard Lynch
On Tue, May 8, 2007 2:12 pm, Eric Trahan wrote:
 $error = $_FILES['uneimage']['error'];

 That doesn't seem work in PHP 4.1.2...  I try it but $error is empty.


 And the function move_uploaded_file($_FILES['uneimage']['tmp_name'],
 $target_path) returns TRUE, so the upload work (in a way !).

 The problem is the file that is upload doesn't match the original
 file.

Is it truncated?

Does have random bytes in the middle missing?

Does only the last half of the file come through?

Is it a Mac with a resource fork not getting through?

How are you measuring the two file sizes?

PS You *still* should have the error checking, if it's available in
your version of PHP.

Actually, at 4.1.2 you probably should upgrade, I suspect,
irrespective of anything else anybody can say...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] Upload problem - final size is different

2007-05-08 Thread Eric Trahan

Le 2007-05-08 à 16:50, Richard Davey a écrit :

By how much is the difference? Are we talking a few bytes, a few  
megabytes, what?


A 116Kb file produce a 68Kb file on the server.  And a 152Kb file  
produce a 48Kb file on the server...




If you then download the file again, is it corrupted, or does it work?


Download the same file twice produce the same problem...


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



Re: [PHP] upload file then move between servers

2007-04-21 Thread Tijnema !

On 4/21/07, blackwater dev [EMAIL PROTECTED] wrote:

I need to allow a user to upload a file.  Once the file is up, I need to
then move it to another server and wsync it to our webclusters.  What's the
best way to do this with php?  I don't really want php issuing root
commands.  I've considered storing the file in the db but really need it to
be scanned (they should just be images) then pushed out to my servers.

Thanks!


You could transfer files between servers using FTP.Or using internal
network connections. like if you have mounted the second server at
/mnt/server2, you could simply move the file with the built in PHP
command.
http://www.php.net/move_uploaded_file

Tijnema




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



Re: [PHP] upload file then move between servers

2007-04-21 Thread Richard Lynch
On Fri, April 20, 2007 5:11 pm, blackwater dev wrote:
 I need to allow a user to upload a file.  Once the file is up, I need
 to
 then move it to another server and wsync it to our webclusters.
 What's the
 best way to do this with php?  I don't really want php issuing root
 commands.  I've considered storing the file in the db but really need
 it to
 be scanned (they should just be images) then pushed out to my servers.

Let PHP do all the checks you can think of, and then
http://php.net/move_uploaded_file to the directory that is getting
wrsync'ed or whatever.

Let root cron job handle the sync.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie 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] upload file

2007-03-04 Thread Stut

Alain Roger wrote:

I would like in fact to make more precise my previous post.
I would like in fact to restrict the file extension (and therefore the user
possibility).

My user should be able only to upload files with extension JPEG, BMP, GIF.

How can i set those parameter ?


You can't control that without using a client-side technology like Java 
or ActiveX. It may also be possible to use Javascript in the onsubmit 
event on the form to check the file extension.


If I may make a suggestion... don't over-complicate it. Trust your users 
to do the right thing on their side, help them by providing 
instructions, and validate what they've sent you in case they don't read 
them.


-Stut

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



Re: [PHP] upload max error

2006-12-22 Thread David Giragosian

On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:



Hey all,

I am new to PHP and have been having issues on max filesize uploads.  I
can
currently upload small files but I wish to make my max upload size huge.
Here is what I have configured in php.ini:

max_execution_time = 3000
max_input_time = 6000
memory_limit = 8000M
post_max_size = 8000M
file_uploads = On
uplad_max_filesize = 5000M
default_socket_timeout = 600

I have also edited the upload script as well.
I am running Apache on OpenBSD, the PHP packages are hardened.
Any help or direction would be great!

Thanks,
Erik
--
View this message in context:
http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
Sent from the PHP - General mailing list archive at Nabble.com.

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



Keep trying larger and larger file uploads, checking Apache and PHP error
logs when you hit a size or timeout limit.

David


Re: [PHP] upload max error

2006-12-22 Thread ibanex22

Thanks guys, I boosted a bunch of values in my configuration files and got it
to work... unfortunetly it only worked once.  I'm sure it worked, but I have
tried to recreate it and I cannot get it to work again.  This is very
confusing to me.  If there is any value that fluxuates... or anything... I
have no idea what to do.



David Giragosian wrote:
 
 On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:
 

 Hey all,

 I am new to PHP and have been having issues on max filesize uploads.  I
 can
 currently upload small files but I wish to make my max upload size huge.
 Here is what I have configured in php.ini:

 max_execution_time = 3000
 max_input_time = 6000
 memory_limit = 8000M
 post_max_size = 8000M
 file_uploads = On
 uplad_max_filesize = 5000M
 default_socket_timeout = 600

 I have also edited the upload script as well.
 I am running Apache on OpenBSD, the PHP packages are hardened.
 Any help or direction would be great!

 Thanks,
 Erik
 --
 View this message in context:
 http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
 Sent from the PHP - General mailing list archive at Nabble.com.

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


 Keep trying larger and larger file uploads, checking Apache and PHP error
 logs when you hit a size or timeout limit.
 
 David
 
 

-- 
View this message in context: 
http://www.nabble.com/upload-max-error-tf2872630.html#a8030902
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] upload max error

2006-12-22 Thread ibanex22

I've got it... it looks like I had boosted something too high. Thanks for the
replies.



ibanex22 wrote:
 
 Thanks guys, I boosted a bunch of values in my configuration files and got
 it to work... unfortunetly it only worked once.  I'm sure it worked, but I
 have tried to recreate it and I cannot get it to work again.  This is very
 confusing to me.  If there is any value that fluxuates... or anything... I
 have no idea what to do.
 
 
 
 David Giragosian wrote:
 
 On 12/22/06, ibanex22 [EMAIL PROTECTED] wrote:
 

 Hey all,

 I am new to PHP and have been having issues on max filesize uploads.  I
 can
 currently upload small files but I wish to make my max upload size huge.
 Here is what I have configured in php.ini:

 max_execution_time = 3000
 max_input_time = 6000
 memory_limit = 8000M
 post_max_size = 8000M
 file_uploads = On
 uplad_max_filesize = 5000M
 default_socket_timeout = 600

 I have also edited the upload script as well.
 I am running Apache on OpenBSD, the PHP packages are hardened.
 Any help or direction would be great!

 Thanks,
 Erik
 --
 View this message in context:
 http://www.nabble.com/upload-max-error-tf2872630.html#a8028989
 Sent from the PHP - General mailing list archive at Nabble.com.

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


 Keep trying larger and larger file uploads, checking Apache and PHP error
 logs when you hit a size or timeout limit.
 
 David
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/upload-max-error-tf2872630.html#a8031085
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Upload not finding directory to write to.

2006-10-29 Thread Jochem Maas
Robert Cummings wrote:
 On Sat, 2006-10-28 at 14:49 +0900, Dave M G wrote:
 PHP List,

 I had a file upload script which was working fine. Then, because of 
 other needs, I changed my local Apache settings so that my local web 
 site directory structure behaved the same as they do on my web hosting 
 service.

 What I mean by that is that before, I would access my local web sites by 
 going to their directories within the localhost (/var/www) directory:

 localhost/web_sites/web_site_one/index.php

 Now I just go to:

 web_site_one/

 If i create a link that says a href=/link/a, it goes to the root 
 of the web site, where the index.php is.

 Within that root directory, I have a directory called image, where I'm 
 trying to put my uploaded image files.

 The destination file location should then be /image/, shouldn't it?

 My code looks like this:

 $fileLocation = /image/ . $_POST['name'];
 if(move_uploaded_file($_FILES['file']['tmp_name'], $fileLocation))
 {
 chmod ($fileLocation, 0777);
 }

 $_POST['name'] is a name for the file that the user has entered.

 But this now gives me an error that it can't open a stream to the 
 destination.

 I also checked to make sure that the image directory has fully open 
 permissions, and it's currently set to drwxrwxrwx, or 0777.

 Am I missing some fundamental issue with directory structures on an 
 Apache server?
 
 
 Shouldn't you have something closer to:
 
 ?php
 
 $fileLocation = '/var/www/web_site_one/image/'.$_POST['name'];
 
 ?
 
 Because your trying to access a filesystem path and not a web path. More
 generically if you want:
 
 ?php
 
 $myPath = ereg_replace( '/.*$', '', __FILE__ );
 $fileLocation = $myPath.'/image/'.$_POST['name'];

and at the very least lets perform a dirname on the name var...

$yourfile = dirname($_POST['name']);

in order to avoid security issues related to directory traversal.

:-)

 
 ?
 
 That still presumes a script in the site's root directory.
 
 Cheers,
 Rob.

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



Re: [PHP] Upload not finding directory to write to.

2006-10-28 Thread Robert Cummings
On Sat, 2006-10-28 at 14:49 +0900, Dave M G wrote:
 PHP List,
 
 I had a file upload script which was working fine. Then, because of 
 other needs, I changed my local Apache settings so that my local web 
 site directory structure behaved the same as they do on my web hosting 
 service.
 
 What I mean by that is that before, I would access my local web sites by 
 going to their directories within the localhost (/var/www) directory:
 
 localhost/web_sites/web_site_one/index.php
 
 Now I just go to:
 
 web_site_one/
 
 If i create a link that says a href=/link/a, it goes to the root 
 of the web site, where the index.php is.
 
 Within that root directory, I have a directory called image, where I'm 
 trying to put my uploaded image files.
 
 The destination file location should then be /image/, shouldn't it?
 
 My code looks like this:
 
 $fileLocation = /image/ . $_POST['name'];
 if(move_uploaded_file($_FILES['file']['tmp_name'], $fileLocation))
 {
 chmod ($fileLocation, 0777);
 }
 
 $_POST['name'] is a name for the file that the user has entered.
 
 But this now gives me an error that it can't open a stream to the 
 destination.
 
 I also checked to make sure that the image directory has fully open 
 permissions, and it's currently set to drwxrwxrwx, or 0777.
 
 Am I missing some fundamental issue with directory structures on an 
 Apache server?


Shouldn't you have something closer to:

?php

$fileLocation = '/var/www/web_site_one/image/'.$_POST['name'];

?

Because your trying to access a filesystem path and not a web path. More
generically if you want:

?php

$myPath = ereg_replace( '/.*$', '', __FILE__ );
$fileLocation = $myPath.'/image/'.$_POST['name'];

?

That still presumes a script in the site's root directory.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] upload image

2006-08-25 Thread Sonja

Hi, 

Thanks for help, I find the error, here is the code of functions.php

?php
/*
  Upload an image and create the thumbnail. The thumbnail is stored
  under the thumbnail sub-directory of $uploadDir.

  Return the uploaded image name and the thumbnail also.
*/
function uploadImage($inputName, $uploadDir)
{
  $image = $_FILES[$inputName];
  $imagePath = '';
  $thumbnailPath = '';

  // if a file is given
  if (trim($image['tmp_name']) != '') {
$ext = substr(strrchr($image['name'], .), 1);

// generate a random new file name to avoid name conflict
// then save the image under the new file name
$imagePath = md5(rand() * time()) . .$ext;
$result= move_uploaded_file($image['tmp_name'], $uploadDir .
$imagePath);

if ($result) {
  // create thumbnail
  $thumbnailPath =  md5(rand() * time()) . .$ext;
  $result = createThumbnail($uploadDir . $imagePath, $uploadDir .
'thumbnail/' . $thumbnailPath, THUMBNAIL_WIDTH);

  // create thumbnail failed, delete the image
  if (!$result) {
unlink($uploadDir . $imagePath);
$imagePath = $thumbnailPath = '';
  } else {
$thumbnailPath = $result;
  }
} else {
  // the image cannot be uploaded
  $imagePath = $thumbnailPath = '';
}

  }


  return array('image' = $imagePath, 'thumbnail' = $thumbnailPath);
}

/*
  Create a thumbnail of $srcFile and save it to $destFile.
  The thumbnail will be $width pixels.
*/
function createThumbnail($srcFile, $destFile, $width, $quality = 75)
{
  $thumbnail = '';

  if (file_exists($srcFile)   isset($destFile))
  {
$size= getimagesize($srcFile);
$w   = number_format($width, 0, ',', '');
$h   = number_format(($size[1] / $size[0]) * $width, 0, ',',
'');

$thumbnail =  copyImage($srcFile, $destFile, $w, $h, $quality);
  }

  // return the thumbnail file name on sucess or blank on fail
  return basename($thumbnail);
}

/*
  Copy an image to a destination file. The destination
  image size will be $w X $h pixels
*/
function copyImage($srcFile, $destFile, $tmpSrc,  $w, $h, $quality = 75)
{
$tmpSrc = pathinfo(strtolower($srcFile));
$tmpDest= pathinfo(strtolower($destFile));
$size   = getimagesize($srcFile);

if ($tmpDest['extension'] == gif || $tmpDest['extension'] == jpg)
{
   $destFile  = substr_replace($destFile, 'jpg', -3);
   $dest  = imagecreatetruecolor($w, $h);
   //imageantialias($dest, TRUE);
} elseif ($tmpDest['extension'] == png) {
   $dest = imagecreatetruecolor($w, $h);
   //imageantialias($dest, TRUE);
} else {
  return false;
}

switch($size[2])
{
   case 1:   //GIF
   $src = imagecreatefromgif($srcFile);
   break;
   case 2:   //JPEG
   $src = imagecreatefromjpeg($srcFile);
   break;
   case 3:   //PNG
   $src = imagecreatefrompng($srcFile);
   break;
   default:
   return false;
   break;
}

 // This is were not allow me to write thumbnail in uploadDirectory,
problems with switch, case2:
// how to resolve this
imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]);

switch($size[2])
{
   case 1:
   case 2:
   imagejpeg($dest,$destFile, $quality);
   break;
   case 3:
   imagepng($dest,$destFile);
}
return $destFile;

}

/*
  Check if the user is logged in or not
*/
function checkLogin()
{
  if (!isset($_SESSION['isLogin']) || $_SESSION['isLogin'] == false) {
header('Location: login.php');
exit;
  }
}

/*
  Create the link for moving from one page to another
*/
function getPagingLink($totalResults, $pageNumber, $itemPerPage = 10,
$strGet = '')
{
  $pagingLink= '';
  $totalPages= ceil($totalResults / $itemPerPage);

  // how many link pages to show
  $numLinks  = 10;

  // create the paging links only if we have more than one page of results
  if ($totalPages  1) {
$self = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ;

// print 'previous' link only if we're not
// on page one
if ($pageNumber  1) {
  $page = $pageNumber - 1;
  if ($page  1) {
$prev =   \$self?pageNum=$page$strGet\ [Prev]  ;
  } else {
$prev =   \$self?$strGet\ [Prev]  ;
  }

  $first =   \$self?$strGet\ [First]  ;
} else {
  $prev  = ''; // we're on page one, don't show 'previous' link
  $first = ''; // nor 'first page' link
}

// print 'next' link only if we're not
// on the last page
if ($pageNumber  $totalPages) {
  $page = $pageNumber + 1;
  $next =   \$self?pageNum=$page$strGet\ [Next]  ;
  $last =   \$self?pageNum=$totalPages$strGet\ [Last]  ;
} else {
  $next = ''; // we're on the last page, don't show 'next' link
  $last = ''; // nor 'last page' link
}

$start = $pageNumber - ($pageNumber % $numLinks) + 1;
$end   = $start + 

RE: [PHP] upload image

2006-08-24 Thread Peter Lauri
Maybe this will help you:

$name = mysql_escape_string($_POST['doc_filename'][$key]);
$author = mysql_escape_string($_POST['doc_filename_author'][$key]);
$filename = mysql_escape_string($value);
$filetype = mysql_escape_string($_FILES['doc_attach']['type'][$key]);
$filesize = mysql_escape_string($_FILES['doc_attach']['size'][$key]);
$filedata = addslashes (fread(fopen
($_FILES['doc_attach']['tmp_name'][$key], r),
filesize($_FILES['doc_attach']['tmp_name'][$key])));


$Query = INSERT INTO filestorage (name, author, filename, filetype,
filesize, filedata) VALUES ('$name', '$author', '$filename', '$filetype',
'$filesize', '{$filedata}');

/Peter



-Original Message-
From: Sonja [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 24, 2006 2:38 PM
To: php-general@lists.php.net
Subject: [PHP] upload image


Hi,

I have problems with uploading image, here is the code

if(isset($_POST['txtTitle']))
{
$albumId   = $_POST['cboAlbum'];
$imgTitle  = $_POST['txtTitle'];
$imgDesc   = $_POST['mtxDesc'];

$images= uploadImage('fleImage', GALLERY_IMG_DIR);

if ($images['image'] == ''  $images['thumbnail'] == '') {
echo Error uploading file;
exit;
}

$image = $images['image'];
$thumbnail = $images['thumbnail'];

if (!get_magic_quotes_gpc()) {
$albumName  = addslashes($albumName);
$albumDesc  = addslashes($albumDesc);
$imgPath= addslashes($imgPath);
}  

$sql = INSERT INTO tbl_image (im_album_id, im_title,
im_description,
im_image, im_thumbnail, im_date) 
VALUES ($albumId, '$imgTitle', '$imgDesc', '$image',
'$thumbnail',
NOW());

mysql_query($sql) or die('Error, add image failed : ' . mysql_error());


echo
scriptwindow.location.href='index.php?page=list-imagealbum=$albumId';/s
cript;
exit;
} 

when I upload a picture return me error uploadin image.

Thanks  

-- 
View this message in context:
http://www.nabble.com/upload-image-tf2157181.html#a5959218
Sent from the PHP - General forum at Nabble.com.

-- 
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] upload image

2006-08-24 Thread Sonja

Hi,
It looks like:

function uploadImage($inputName, $uploadDir)
{
$image = $_FILES[$inputName];
$imagePath = '';
$thumbnailPath = '';

// if a file is given
if (trim($image['tmp_name']) != '') {
$ext = substr(strrchr($image['name'], .), 1); 

// generate a random new file name to avoid name conflict
// then save the image under the new file name
$imagePath = md5(rand() * time()) . .$ext;
$result= move_uploaded_file($image['tmp_name'], $uploadDir .
$imagePath);

if ($result) {
// create thumbnail
$thumbnailPath =  md5(rand() * time()) . .$ext;
$result = createThumbnail($uploadDir . $imagePath, 
$uploadDir .
'thumbnail/' . $thumbnailPath, THUMBNAIL_WIDTH);

// create thumbnail failed, delete the image
if (!$result) {
unlink($uploadDir . $imagePath);
$imagePath = $thumbnailPath = '';
} else {
$thumbnailPath = $result;
}   
} else {
// the image cannot be uploaded
$imagePath = $thumbnailPath = '';
}

}


return array('image' = $imagePath, 'thumbnail' = $thumbnailPath);
}


Mourad Boulahboub wrote:
 
 Hi sonja,
 
 
 
 Sonja schrieb am 24.08.2006 09:38:
 Hi,
 
 I have problems with uploading image, here is the code
 
 if(isset($_POST['txtTitle']))
 {
  $albumId   = $_POST['cboAlbum'];
  $imgTitle  = $_POST['txtTitle'];
  $imgDesc   = $_POST['mtxDesc'];
 
  $images= uploadImage('fleImage', GALLERY_IMG_DIR);
 
 how does the function uploadImage looks like?
 
 
  if ($images['image'] == ''  $images['thumbnail'] == '') {
  echo Error uploading file;
  exit;
  }
 
 the error comes from this if-clause that is depending from the function
 above.
 
 regards
 Mourad
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/upload-image-tf2157181.html#a5961434
Sent from the PHP - General forum at Nabble.com.

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



Re: [PHP] Upload files problem with IIS server

2006-08-04 Thread chris smith

On 8/5/06, Mace Eliason [EMAIL PROTECTED] wrote:

Hi,

I am having problems with uploading files to a windows server using
php.  I have used the same script on other server with no problems.

 From what I can tell this new server is running windows with IIS.  I
think the problem is with the path.

Does anyone have any suggestions?  Here is a snipet of some of the code.

$uploadDir =  /gamestats/;

  $uploadFile = $uploadDir . $_FILES['bannerfile']['name'];
  echo $bannerfile . br;  /* added for testing */
  echo $uploadDir . br; /* added for testing */
  echo $uploadFile . br; /* added for testing */

  if (move_uploaded_file($_FILES['bannerfile']['tmp_name'], $uploadFile))
  {
 ..


and the errors you get are... ?

check the folder is writable:

echo is_writable:  . is_writable($uploadDir) . br/;

Is that the whole code? I doubt this would work on linux platforms
either because your script will not be able to create /gamestats (ie
in the / folder, not in your /home/httpd/domain.com folder or
where-ever it is).

IIS needs the destination folder marked with 'modify' permissions in
IIS so you can create and delete files, maybe that's the problem.
--
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] Upload a big file.

2006-07-13 Thread Dave Goodchild

On 13/07/06, João Cândido de Souza Neto [EMAIL PROTECTED] wrote:


Hello gang.

I´ve got a e-commerce system where one can import data from his management
system.

This importation files sometimes has a size about 8Mb. Unfortunatly, when
one try to put this file into e-commerce, generaly one gets any error
because your connection speed is very slow and can´t send this file.

There´s any way to increase this wait time and get big files?

Thanks.

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

First of all, use set_time_limit(0) in your script, which gives an

unlimited execution time. Then amend the max files size limit in php.ini, or
locally.


--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


RE: [PHP] Upload a big file.

2006-07-13 Thread Jay Blanchard
[snip]
 First of all, use set_time_limit(0) in your script, which gives an
unlimited execution time. Then amend the max files size limit in php.ini, or
locally.
[/snip]

You will likely have to do the same thing in Apache (or whatever your web 
server software is) as there will be a time-out built into that as well.

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



Re: [PHP] Upload a big file.

2006-07-13 Thread Jochem Maas
João Cândido de Souza Neto wrote:
 Hello gang.
 
 I´ve got a e-commerce system where one can import data from his management 
 system.
 
 This importation files sometimes has a size about 8Mb. Unfortunatly, when 
 one try to put this file into e-commerce, generaly one gets any error 
 because your connection speed is very slow and can´t send this file.
 
 There´s any way to increase this wait time and get big files?

take note of what the other respondents wrote regardless upload and timeout 
limits
(in both apache and php)

but 

you might also consider that it may be better to automate the process somewhat 
by
having the back office system (S)FTP the 'import file' and using an automated 
job
(e.g. php script set to run regularly via cron) to check for the existence of
said 'import file' and process it if it exists. basically the idea being to
remove the requirement for user and browser interaction from the import
process completely.

 
 Thanks.
 

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



Re: [PHP] Upload files problems

2006-05-26 Thread Rory Browne

It's very hard to read code, when either there is no comments, or the
comments are in a language you don't understand.

Hablo pocito Espanol, pero no entiendo bastante para entiender que quiere
decir.

Rory

On 5/25/06, Ing. Tomás Liendo [EMAIL PROTECTED] wrote:


Hi!
When the users of my system try to go up files of more than 460 K, they
receive the message:
Fatal error: Maximum execution time of 90 seconds exceeded in
c:\websites\iracbiogenar48\iracbiogen.com.ar\virtual\procesa_msjpriv.php
on
line 2

I'm using the following method to up load the files:

if($archivo_name)
{
   $dpath=./archivos_recibidos/.$archivo_name;
 if(move_uploaded_file($archivo, $dpath))
 {//Se realiza la transmision del archivo al servidor.
 echo font size=2 face=Arial, Helvetica, sans-serifEl
archivo
.$archivo_name.. ha sido transferido exitosamente./font/div/td;
}
else
{
 echo font size=2 face=Arial, Helvetica,
sans-serifADVERTENCIA: El arcvhio .$archivo_name.. no ha podido
enviarse./font/div/td;
}


Do I have control on these 90 seconds? or is a parameter of the server?
What can I do to solve this problem?

Ahead of time thank you very much,

Tom.

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




Re: [PHP] Upload files problems

2006-05-26 Thread André Medeiros

I believe that those 90 seconds start counting as soon as php starts
interpreting the request, ie. after getting the file and form, not
when it starts uploading.

The second one wouldn't make much sense.

On 5/26/06, Rory Browne [EMAIL PROTECTED] wrote:

It's very hard to read code, when either there is no comments, or the
comments are in a language you don't understand.

Hablo pocito Espanol, pero no entiendo bastante para entiender que quiere
decir.

Rory

On 5/25/06, Ing. Tomás Liendo [EMAIL PROTECTED] wrote:

 Hi!
 When the users of my system try to go up files of more than 460 K, they
 receive the message:
 Fatal error: Maximum execution time of 90 seconds exceeded in
 c:\websites\iracbiogenar48\iracbiogen.com.ar\virtual\procesa_msjpriv.php
 on
 line 2

 I'm using the following method to up load the files:

 if($archivo_name)
 {
$dpath=./archivos_recibidos/.$archivo_name;
  if(move_uploaded_file($archivo, $dpath))
  {//Se realiza la transmision del archivo al servidor.
  echo font size=2 face=Arial, Helvetica, sans-serifEl
 archivo
 .$archivo_name.. ha sido transferido exitosamente./font/div/td;
 }
 else
 {
  echo font size=2 face=Arial, Helvetica,
 sans-serifADVERTENCIA: El arcvhio .$archivo_name.. no ha podido
 enviarse./font/div/td;
 }


 Do I have control on these 90 seconds? or is a parameter of the server?
 What can I do to solve this problem?

 Ahead of time thank you very much,

 Tom.

 --
 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] Upload files problems

2006-05-26 Thread Rabin Vincent

On 5/25/06, Ryan Creaser [EMAIL PROTECTED] wrote:

Ing. Tomás Liendo wrote:

Hi!
When the users of my system try to go up files of more than 460 K, they
receive the message:
Fatal error: Maximum execution time of 90 seconds exceeded in
c:\websites\iracbiogenar48\iracbiogen.com.ar\virtual\procesa_msjpriv.php on
line 2

I'm using the following method to up load the files:

if($archivo_name)
{
   $dpath=./archivos_recibidos/.$archivo_name;
 if(move_uploaded_file($archivo, $dpath))
 {//Se realiza la transmision del archivo al servidor.
 echo font size=2 face=Arial, Helvetica, sans-serifEl archivo
.$archivo_name.. ha sido transferido exitosamente./font/div/td;
}
else
{
 echo font size=2 face=Arial, Helvetica,
sans-serifADVERTENCIA: El arcvhio .$archivo_name.. no ha podido
enviarse./font/div/td;
}


Do I have control on these 90 seconds? or is a parameter of the server?
What can I do to solve this problem?

Ahead of time thank you very much,

Tom.



See http://php.net/set_time_limit, although it might not work if your
host uses safe mode.


In addition to using set_time_limit, you'll probably also need to change
the value of the max_input_time option:
http://php.net/manual/en/ref.info.php#ini.max-input-time

Rabin

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



Re: [PHP] Upload files problems

2006-05-26 Thread Ing. Tom�s Liendo
My host uses safe mode...
What other thing can I do?
Some other method exists to send files besides POST method?

Thank you,

Tom.


Ryan Creaser [EMAIL PROTECTED] escribió en el mensaje 
news:[EMAIL PROTECTED]
 Ing. Tomás Liendo wrote:

Hi!
When the users of my system try to go up files of more than 460 K, they 
receive the message:
Fatal error: Maximum execution time of 90 seconds exceeded in 
c:\websites\iracbiogenar48\iracbiogen.com.ar\virtual\procesa_msjpriv.php 
on line 2

I'm using the following method to up load the files:

if($archivo_name)
{
   $dpath=./archivos_recibidos/.$archivo_name;
 if(move_uploaded_file($archivo, $dpath))
 {//Se realiza la transmision del archivo al servidor.
 echo font size=2 face=Arial, Helvetica, sans-serifEl 
 archivo .$archivo_name.. ha sido transferido 
 exitosamente./font/div/td;
}
else
{
 echo font size=2 face=Arial, Helvetica, 
 sans-serifADVERTENCIA: El arcvhio .$archivo_name.. no ha podido 
 enviarse./font/div/td;
}


Do I have control on these 90 seconds? or is a parameter of the server?
What can I do to solve this problem?

Ahead of time thank you very much,

Tom.


 See http://php.net/set_time_limit, although it might not work if your host 
 uses safe mode.

 - Ryan 

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



Re: [PHP] Upload files problems

2006-05-26 Thread chris smith

On 5/27/06, Ing. Tomás Liendo [EMAIL PROTECTED] wrote:

My host uses safe mode...
What other thing can I do?
Some other method exists to send files besides POST method?


ftp?

You haven't solved your problem which actually has nothing to do with
file uploading (460k is nothing and should upload very quickly).

We haven't seen enough code to work out your actual problem.

Track down where all of your time is going by using the 'time()'
function and go from there.

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

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



  1   2   3   4   >