Re: [PHP] Re: Redirection Question (I spoke to soon)

2003-07-23 Thread Grant Rutherford
You need the http://;  ie.  http://www.microsoft.com;

Beauford.2005 wrote:

Errors are on and I get nothing, it won't even direct if I hard code
header(Location: www.microsoft.com);
 



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


Re: [PHP] javascript php

2003-07-28 Thread Grant Rutherford
 $color = script!--
  document.write(screen.colorDepth)
  //--
  /script;
  $query = mysql_query(select id from color where color = '$color' );
 $a = mysql_num_rows($query);
Actually, what you want to do is possible, but difficult.

If you are willing to tolerate a page refresh, you can use this code to 
implement this function:

html
//header
?php
if (empty($_GET['color'])){
?
   body onLoad=document.aform.color.value=screen.colorDepth; 
document.aform.submit(); return true;
   form name=aform action=?php echo $_SERVER['PHP_SELF']; ? method=get
   input type=hidden name=color
   /form
?php
   exit();
} // if
else{
   $color = $_GET['color'];
   $query = mysql_query(select id from color where color = '$color' );
   $a = mysql_num_rows($query);
?php
   body
?
} // else

// rest of page

I'm not sure that this particular script will work, but I think that 
this method is the best way to have javascript send things to php.

Hope this helps,
Grant


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


[PHP] Serve a file using PHP

2003-08-26 Thread Grant Rutherford
Hello,

Is there a way that PHP can allow a user to browse the files on the 
server's network, and ultimately send the file to the user?

I'm making a database interface with PHP to be used internally on our 
network.  Through a PHP interface, the user wants to browse their 
network and find a file, and insert the file's path into the database.  
The user then wants the database to display a link, which when clicked 
will open the file.  They want this to work in Mozilla or IE, on both 
windows and linux machines.  I tried making the path a link with 
file://path, but Mozilla wouldn't follow the link (probably a security 
thing; it makes sense that links shouldn't open local files).

Is there a way that I can give PHP the network path (through $_POST for 
example), and it would return the file instead of an HTML document?

Thanks for any help,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Serve a file using PHP

2003-08-29 Thread Grant Rutherford
Thanks for your reply,

I think my mail was blocked for a few days here.  Sorry for the delay.

a HREF='file:///home/users/grant/Parts.txt'file:///home/users/grant/Parts.txt/a

This link will not work in Mozilla. (Does nothing)  However, if I copy 
and paste the address into the addess bar, it works fine.  I suspect 
this is a security thing.

I don't think that PHP being server side should make a huge difference.  
The client and server are on the same network in this case, and the 
files would be on another server on the same network.  Is there a way 
that the PHP server can access the file over the network and then send 
it to the client?  I don't think I can make the client open the file itself.

Thanks,
Grant
[EMAIL PROTECTED] wrote:

Bit suprised that mozilla didn't let you access the file using the 
'file://' notation. Did you actually use three slashes? ie it should be
'file:///home/grant' and not 'file://home/grant/'
There isn't any other way in which you can use PHP to access files on 
a hard disk. PHP is a server side scripting language. You could always 
try signed java applets. 
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Serve a file using PHP

2003-08-29 Thread Grant Rutherford
Hello there,

The line:

a HREF='\\vesuvius\home\users\grant\Parts.txt'\\vesuvius\home\users\grant\Parts.txt/a

Gives the object not found page in Mozilla, even when clicked on from 
the vesuvius computer.  I think that it is treating this like a relative 
link.

Thanks for the help,
Grant
CPT John W. Holmes wrote:

Can't you just link to \\computer_name\path\to\file.doc (or whatever the
filename is) ?
file:/// would try to load it off of their machine, not a network machine.

---John Holmes...

 



--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Serve a file using PHP

2003-08-29 Thread Grant Rutherford
Hi,

Thanks for the advice.  I will run this past the people in charge of the 
network.  I'm afraid that I'm not really very familiar with our network 
here (I'm just an intern :) )  I am pretty sure that all of our files 
are sent from a single server, which is neither the php server or my 
computer.  Perhaps I can get them to make the necessary files accessible 
by ftp or some other method.

Thanks again,
Grant
Raditha Dissanayake wrote:

Hello,

More suprising is that the html you have below works perfectly on my 
mozzilla 1.4 running on Red Hat 9 :-) provided i do have this
exact path on my computer. /home/users/grant/Parts.txt

From what you are saying it looks like in your case 
'/home/users/grant/Parts.txt' does not exist on your computer but 
exists on another one. I am sorry to say PHP being a server side 
scripting language indeed has a huge effect on this.

One suggestion that i have is for you to you NFS (ouch) or samba and 
place that link in your php code. If you use NFS and mount it properly 
yes PHP being server side solution may not matter.  :-)

Other alternative is for you to use good old FTP. PHP has an FTP api, 
however since you are on the same network you can even create links 
such as fttp://othermachine/home/users/grant/parts.txt and it would 
work just fine. IN this case mozzila will open the ftp connection and 
fetch the file for you.

all the best
raditha


--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Redirect to a different frame...

2003-07-03 Thread Grant Rutherford
Hello there,

I was wondering if there is a way to use the header function in php to
redirect the browser's output to a different frame.

Specifically, I have a form on frame A which has two submit buttons.  I
would like one to submit the data in the form to a page which will load
in frame A, and the other to submit the data to the same page which will
load in frame B.

I was hoping that I could put some code at the top of the results page
which will tell the browser which frame to display it in (dependent on
which $_POST variable is set).  Is this possible?

Thanks,
Grant


-- 
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB Canada R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure,
copying or distribution of its contents is strictly prohibited.
If you have received this message in error, please destroy it
and advise the sender immediately by phone, email or facsimile.


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



RE: [PHP] Redirect to a different frame...

2003-07-03 Thread Grant Rutherford
Hi there,

Thanks for your response.  I understand that I can specify a target in
the form tag.  However, if I were to do that both buttons would have to
go to the same frame.  (I think?)

If I could specify the target for each submit button, that would work
perfectly.  Also, if I could have the same input fields shared between
two forms (one for each target destination).  However, I don't think
that either of these is an option in regular HTML.

Thanks,
Grant


On Thu, 2003-07-03 at 10:41, Dan Joseph wrote:
 Hi,
 
  I was wondering if there is a way to use the header function in php to
  redirect the browser's output to a different frame.
 
  Specifically, I have a form on frame A which has two submit buttons.  I
  would like one to submit the data in the form to a page which will load
  in frame A, and the other to submit the data to the same page which will
  load in frame B.
 
   in your form tag, you can put target=framename, example:
 
   form method=post name=framename action=file.php target=framethree
 
   Anything submitted from that frame will target the specified frame.  No
 fancy PHP needed, unless you want to make the target dynamic.
 
 -Dan Joseph
-- 
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB Canada R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure,
copying or distribution of its contents is strictly prohibited.
If you have received this message in error, please destroy it
and advise the sender immediately by phone, email or facsimile.


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



RE: [PHP] Redirect to a different frame...

2003-07-03 Thread Grant Rutherford
Hi there,

Thank you!

I had a feeling that javascript would be the answer, but as I have not
yet learned javascript, I was hoping that php would work.  Oh, well.  No
sense putting that off anymore.  Time to delve into the javascript
tutorials.

Thanks for your time, everyone.
Grant


On Thu, 2003-07-03 at 11:07, Adam Voigt wrote:
 input type=button value=Button 1
 onclick=javascript:document.formname.target =
 'frame1';document.formname.submit();
 
 input type=button value=Button 2
 onclick=javascript:document.formname.target =
 'frame2';document.formname.submit();
 
 
 On Thu, 2003-07-03 at 12:02, Dan Joseph wrote:
  Oh, yeah, that is correct.  You'd need to use the button tag and put some
  javascript in them to target the frames.  I'm not up on the javascript
  enough though, check javascript.internet.com for more information.
  
  -Dan Joseph
  
   -Original Message-
   From: Grant Rutherford [mailto:[EMAIL PROTECTED]
   Sent: Thursday, July 03, 2003 12:03 PM
   To: Dan Joseph
   Cc: PHP Mailing List
   Subject: RE: [PHP] Redirect to a different frame...
  
  
   Hi there,
  
   Thanks for your response.  I understand that I can specify a target in
   the form tag.  However, if I were to do that both buttons would have to
   go to the same frame.  (I think?)
  
   If I could specify the target for each submit button, that would work
   perfectly.  Also, if I could have the same input fields shared between
   two forms (one for each target destination).  However, I don't think
   that either of these is an option in regular HTML.
  
   Thanks,
   Grant
  
  
   On Thu, 2003-07-03 at 10:41, Dan Joseph wrote:
Hi,
   
 I was wondering if there is a way to use the header function in php to
 redirect the browser's output to a different frame.

 Specifically, I have a form on frame A which has two submit
   buttons.  I
 would like one to submit the data in the form to a page which
   will load
 in frame A, and the other to submit the data to the same page
   which will
 load in frame B.
   
in your form tag, you can put target=framename, example:
   
form method=post name=framename action=file.php
   target=framethree
   
Anything submitted from that frame will target the
   specified frame.  No
fancy PHP needed, unless you want to make the target dynamic.
   
-Dan Joseph
   --
   Grant Rutherford
   Iders Incorporated
   600A Clifton Street
   Winnipeg, MB Canada R3G 2X6
   http://www.iders.ca
   tel: 204-779-5400 ext 36
   fax: 204-779-5444
  
   This message is intended solely for the use of the designated
   recipient(s) and their appointed delegates, and may contain
   confidential information.  Any unauthorized disclosure,
   copying or distribution of its contents is strictly prohibited.
   If you have received this message in error, please destroy it
   and advise the sender immediately by phone, email or facsimile.
  
 -- 
 Adam Voigt ([EMAIL PROTECTED])
 Linux/Unix Network Administrator
 The Cryptocomm Group
-- 
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB Canada R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure,
copying or distribution of its contents is strictly prohibited.
If you have received this message in error, please destroy it
and advise the sender immediately by phone, email or facsimile.


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



Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Grant Rutherford
Chris Shiflett wrote:

--- Reuben D. Budiardja wrote:
 

I did strive for that. But whatever character I choose, the problem
remains that we can't guarantee that it's going ot be only used as
deliminater, since the deliminated string is an input from user. So
the problem remains.
   

Well, just to point out, your delimiter can be anything, including:

)[EMAIL PROTECTED]*(donotusethisstringofcharactersinanything(*[EMAIL PROTECTED])

Of course, at some point, that method of playing with probability becomes
unrealistic, and it is imperfect.
John's suggestion of URL encoding is likely your best bet. Given your string:

$foo:$bar:$blah

Make that instead:

urlencode($foo) . '' . urlencode($bar) . '' . urlencode($blah)

Then you can use  as your delimiter and be guaranteed that it does not exist
within each string. It is also easy to recover the original strings, and since
you are using PHP functions, there is less code to write (always a big plus).
Hope that helps.

Chris

=
Become a better Web developer with the HTTP Developer's Handbook
http://httphandbook.org/
 

I like the way you encode things like $ in php.

$ = delimiter
/$ = $
//$ = /delimiter
///$ = /$
$ = //delimiter
/$ = //$
etc.
 = //
/$/$ = $$
etc.
To encode the input, just change every / to a // and every $ to a /$.  
Decoding is the opposite.  I don't think that there are any weird 
situations that can screw this up.  You can use the same escape 
character / for any special character, ie /@ or /: if necessary.

Grant





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


Re: [PHP] Redirection Question

2003-07-22 Thread Grant Rutherford
Hello there,

I had the same problem, and to solve it I put the following code in my 
check login include file:

   // code to detect no login
   session_start();
   session_register('target');
   $_SESSION['target'] = http://; . $_SERVER['SERVER_NAME'] . 
$_SERVER['REQUEST_URI'];
   header(Location:  . $loginpage);

This stores the user's original destination into a session variable.  I 
then just have the login page check to see if target is set:

   // code to authenticate login
   session_start()
   if (!empty($_SESSION['target'])){
   $target = 'Location: ' . $_SESSION['target'];
   session_unregister('target');
   header($target);
   } // if
I hope this helps,
Grant
Beauford.2005 wrote:

Hi,

I am trying to figure out how to redirect a user back to a page but not
having much luck. 

For example: I click on a menu item on my site which goes to a.php. This
file includes another file that determines if they are logged in or not.
If not, they are sent to login.php using header(:Location:  ). How
would I automatically redirect them back to a.php after they have logged
in successfully. I have tried using HTTP_REFERRER, but it isn't
redirecting.
Any help is appreciated.

 



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


[PHP] File Download

2003-10-03 Thread Grant Rutherford
Hi there,

I would like to send an arbitrary file to a user.  This file will be on 
the server in the PHP directory.  I will also want to rename it before 
it is sent, but keep the old file with the old filename.

Any help is appreciated...
Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Download

2003-10-03 Thread Grant Rutherford
Maybe I should clarify this:

I have a the php file:
/var/www/html/dev/view_files_disply.php
This file accepts a POST argument which identifies $filename (example 
1392_foobar.txt) of a file stored on the server at:
/var/www/html/files/1392_foobar.txt

This filename is generated by PHP and is therefore rather cryptic.  I 
have more meaningful filenames stored in a database
example: 1392_foobar.txt - foobar.txt

I would like the view_files_display.php script to send the appropriate 
file to the user, with the appropriate filename (foobar.txt), but to 
leave the file 1392_foobar.txt on the server unmodified for future requests.

I am currently considering copying the file and renaming it, and then 
using a header(location=) to redirect the user to the renamed file, but 
I'm not sure how to ensure that the temporary file is deleted afterwards.

Any suggestions?
Thanks,
Grant
Grant Rutherford wrote:

Hi there,

I would like to send an arbitrary file to a user.  This file will be 
on the server in the PHP directory.  I will also want to rename it 
before it is sent, but keep the old file with the old filename.

Any help is appreciated...
Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Quick question: PHP user?

2003-10-10 Thread Grant Rutherford
Hi,

Just a quick question...  What user does php run as on linux?  Is it the 
Apache user?  Is there some way to tell?  I need to be able to set a 
directory so that only PHP can access it.

Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Rename the current page

2003-10-17 Thread Grant Rutherford
Hi there,

I would like a user to request the page view_file.php, and I would 
like php to generate an arbitrary file and send it to the user.  This is 
all okay, however, I would like to rename the sent page so that the 
browser doesn't open it in a window as an html file but instead brings 
up the open/save dialog box.  I would also like it to do this without 
creating any new files on my server.

For instance, this is how I would like it to work:

Client requests 'view_files.php',
view_files.php generates the output and sends it to the client as the 
file 'result031017.txt' with header Content-Type: text/plain,
The client is presented with an open/save dialog with 'result031017.txt' 
as the default file name

Please note that the file name itself will be dynamic and part of the 
output.

I have tried many variations of the header command, but no luck so far.  
It seems to work okay on Mozilla browsers but not IE.

Can anyone offer any advice, or tell me if this is not going to be possible?

Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Rename the current page

2003-10-17 Thread Grant Rutherford
Grant Rutherford wrote:

Alternatively, is there some way that I could generate that file, 
redirect the user to it, and then delete the file again afterwards?  I 
know how to do all of this except delete the file.  Is there some way to 
schedule a command to be run after the script is finished?

Thanks,
Grant
Hi there,

I would like a user to request the page view_file.php, and I would 
like php to generate an arbitrary file and send it to the user.  This 
is all okay, however, I would like to rename the sent page so that the 
browser doesn't open it in a window as an html file but instead brings 
up the open/save dialog box.  I would also like it to do this 
without creating any new files on my server.

For instance, this is how I would like it to work:

Client requests 'view_files.php',
view_files.php generates the output and sends it to the client as the 
file 'result031017.txt' with header Content-Type: text/plain,
The client is presented with an open/save dialog with 
'result031017.txt' as the default file name

Please note that the file name itself will be dynamic and part of the 
output.

I have tried many variations of the header command, but no luck so 
far.  It seems to work okay on Mozilla browsers but not IE.

Can anyone offer any advice, or tell me if this is not going to be 
possible?

Thanks,
Grant


--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.


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


Re: [PHP] Rename the current page

2003-10-17 Thread Grant Rutherford
Thanks for your response,

What I tried was the following:

header(Content-type: text/plain);
header(Content-Disposition: attachment; filename=\textfile.txt\);
echo $output;
This works properly on Mozilla, however the following problems occur in IE:

IE version 5.50.4522.1800 - 2 dialog boxes appear, and while save as 
appears to work properly, open doesn't work at all
IE version 5.50.4134.0600 - Text appears in the browser window, no 
dialog appears

I'm not sure if the service pack is installed.  Is there any way to do 
this besides the Content-Disposition header?  Perhaps by sending a 
location header without actually redirecting?

Thanks,
Grant
CPT John W. Holmes wrote:

From: Grant Rutherford [EMAIL PROTECTED]
 

I have tried many variations of the header command, but no luck so far.
It seems to work okay on Mozilla browsers but not IE.
   

Okay, what have you actually tried? What are you using now? Have you read
through _all_ of the comments on the manual page for header?
All you need to do is send a header() that signifies the following data is
an attachment so the save/open dialog will popup. You can use the same file,
just conditionally send the appropriate headers.
---John Holmes...

 



--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] File Upload problem

2003-10-20 Thread Grant Rutherford
Hi there,

I'm trying to get a file upload to work with PHP.

The file I'm attempting to upload is a 742kB pdf file, but this will have to work for files up to 50Mb of all types eventually.

The following test pages work fine if the receiving page (testdone) is saved with an html extension, but they return a Document Contains no Data error if it has a php extension.  The inclusion or exclusion of a MAX_FILE_SIZE hidden field does not seem to effect the situation.

In addition, the upload appears to work fine for smaller files. (239kB works fine on both .php and .html)

I'm using PHP with apache viewed on Mozilla, and the following simple HTML:

teststart.html:
HTMLHEADTITLETest Page/TITLE/HEAD
BODY
H1 ALIGN=CENTERTest Page/H1
FORM ACTION='testdone.***' METHOD=POST NAME=aform ENCTYPE='multipart/form-data'
P ALIGN=CENTERINPUT TYPE=FILE NAME=testfileINPUT TYPE=SUBMIT NAME=add 
VALUE='Submit'/P
/FORM
/BODY
/HTML
testdone.***:
HTMLHEADTITLETest Page/TITLE/HEAD
BODY
H1 ALIGN=CENTERTest Page/H1
P ALIGN=CENTERFile Upload Successful/P
/BODY
/HTML
The parts of my php.ini file that I think may be relevant are:

memory_limit = 80M
post_max_size = 1M
file_uploads = On
upload_max_filesize = 1M
Any help would be appreciated

Thanks,
Grant


--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: File Upload problem

2003-10-20 Thread Grant Rutherford
No, I'm afraid that the results are nearly instantaneous.  If it timed 
out, there should be a corresponding delay before I got the error message.

Thanks,
Grant
pete M wrote:

It might be the script timing out - defaults to 20 seconds

check
set_time_limit()
regards
pete


--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Upload problem

2003-10-20 Thread Grant Rutherford
I've tried a few more things, still with no success.  Increasing 
post_max_size and upload_max_filesize to 100M doesn't fix the 
problem.  Turning error logging on doesn't seem to catch any errors.  Is 
it possible that this is a problem with apache, and if so how should I 
go about fixing it?

Thanks,
Grant
Grant Rutherford wrote:

Hi there,

I'm trying to get a file upload to work with PHP.

The file I'm attempting to upload is a 742kB pdf file, but this will 
have to work for files up to 50Mb of all types eventually.

The following test pages work fine if the receiving page (testdone) is 
saved with an html extension, but they return a Document Contains no 
Data error if it has a php extension.  The inclusion or exclusion of 
a MAX_FILE_SIZE hidden field does not seem to effect the situation.

In addition, the upload appears to work fine for smaller files. (239kB 
works fine on both .php and .html)

I'm using PHP with apache viewed on Mozilla, and the following simple 
HTML:

teststart.html:
HTMLHEADTITLETest Page/TITLE/HEAD
BODY
H1 ALIGN=CENTERTest Page/H1
FORM ACTION='testdone.***' METHOD=POST NAME=aform 
ENCTYPE='multipart/form-data'
P ALIGN=CENTERINPUT TYPE=FILE NAME=testfileINPUT TYPE=SUBMIT 
NAME=add VALUE='Submit'/P
/FORM
/BODY
/HTML

testdone.***:
HTMLHEADTITLETest Page/TITLE/HEAD
BODY
H1 ALIGN=CENTERTest Page/H1
P ALIGN=CENTERFile Upload Successful/P
/BODY
/HTML
The parts of my php.ini file that I think may be relevant are:

memory_limit = 80M
post_max_size = 1M
file_uploads = On
upload_max_filesize = 1M
Any help would be appreciated

Thanks,
Grant





--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Upload problem

2003-10-20 Thread Grant Rutherford
Hi there,

I'm running PHP version 4.2.2

I included all of my code in my origional post.  If you would like it 
reposted, I can do that.  I retried it with exactly the same code as the 
manual has in the file uploads section (cut and paste).  I'm merely 
trying to get the upload to work, I'm not concerned about handling the 
file yet!  If I can get the second page to load, then I could move the 
file, rename it or whatever, but it keeps returning The document 
contains no data and as far as I know the php script isn't even run.

Thanks,
Grant
Jay Blanchard wrote:

Grant,

What version of PHP are you running, and at the risk of being redundant,
are you doing exactly what the manual says to do reguarding uploads? Try
that first, and then lets work from there.
Jay

 



--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] File Upload problem

2003-10-20 Thread Grant Rutherford
I found the problem!!!

Buried deep within the manual:

LimitRequestBody
in
/etc/httpd/conf.d/php.conf
was set too small.

Thanks for your time everyone,
Grant
--
Grant Rutherford
Iders Incorporated
600A Clifton Street
Winnipeg, MB
R3G 2X6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Quick ereg_replace question

2003-12-02 Thread Grant Rutherford
Hi,

I need a regular expression which will eliminate all characters except 
numbers, period, and +, -, *, or /

I am currently using:
$new_value = ereg_replace('[^0-9\.-/+*]', , $value);
However, this seems to eliminate - as well.  Any help would be appreciated.

Also, any good references for regular expressions?

Thanks,
Grant
--
Grant Rutherford
Iders Incorporated
100-137 Innovation Drive
Winnipeg, MB, Canada R3T 6B6
http://www.iders.ca
tel: 204-779-5400 ext 36
fax: 204-779-5444

Iders Incorporated: Confidential

Note: This message is intended solely for the use of the designated
recipient(s) and their appointed delegates, and may contain
confidential information.  Any unauthorized disclosure, copying or
distribution of its contents is strictly prohibited.  If you have
received this message in error, please destroy it and advise the sender
immediately by phone, Email or facsimile.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php