[PHP] Uploading file problem
I'm very new to PHP, so I hope no one is offended by reading my very basic questions. I have created a web form that saves some data to a database and uploads three files, copies them to a new directory, and renames them. From my work machine and home machine, it works great for me - there are never any errors. When my boss tries it, two of the files work fine, but the other fails at the copy. I have watched him do it, and it's not user error. What could the problem be? I'm stumped! I can include code or links if needed. Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Uploading file problem
The files go to different directories, but I checked the permissions on all of the directories, and they are all '777'. I am able to upload files, so I think the directory is ok. The server is unix. I am going to ask my boss to send me the files he is trying to upload to see if the files are the problem. If they are, what sort of problems would I look for? On Thu, 6 Mar 2003, Rich Gray wrote: > > I'm very new to PHP, so I hope no one is offended by reading my very basic > > questions. > > > > I have created a web form that saves some data to a database and uploads > > three files, copies them to a new directory, and renames them. From my > > work machine and home machine, it works great for me - there are never any > > errors. When my boss tries it, two of the files work fine, but the other > > fails at the copy. I have watched him do it, and it's not user error. > > What could the problem be? I'm stumped! > > > > I can include code or links if needed. > > > > Thanks, > > Amanda > > From what you say above I'd check the permissions on the 3rd target > directory to check if it allows writes by the web server process. Are all 3 > files going into the same directory? Is the server *nix or Windows? > > Rich > > > -- > 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] Uploading file problem
Well, I have a statement that says: if ([EMAIL PROTECTED]($photo, $long_path . "speakers/" . $photo_name)) { echo an error }else{ proceed with renaming the file } The error that is echoed after the copy is the one that pops up. So, it could be some other problem, but I'm not sure what to look for. On Thu, 6 Mar 2003, Mark Heintz PHP Mailing Lists wrote: > > What do you mean by "fails at the copy"? Have you verified that the > filename and path you're copying to is valid? Otherwise, if the filename > that is failing is consistently the same, and if it's attempting to > overwrite an existing file, it could be a permissions problem. Just a > couple of guesses... > > mh. > > On Thu, 6 Mar 2003, Amanda McComb wrote: > > > I'm very new to PHP, so I hope no one is offended by reading my very basic > > questions. > > > > I have created a web form that saves some data to a database and uploads > > three files, copies them to a new directory, and renames them. From my > > work machine and home machine, it works great for me - there are never any > > errors. When my boss tries it, two of the files work fine, but the other > > fails at the copy. I have watched him do it, and it's not user error. > > What could the problem be? I'm stumped! > > > > I can include code or links if needed. > > > > Thanks, > > Amanda > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Uploading file problem
Thanks!! I'll give that a try! On Thu, 6 Mar 2003, 1LT John W. Holmes wrote: > > Well, I have a statement that says: > > > > if ([EMAIL PROTECTED]($photo, $long_path . "speakers/" . $photo_name)) { > > echo an error > > }else{ > > proceed with renaming the file > > } > > > > The error that is echoed after the copy is the one that pops up. So, it > > could be some other problem, but I'm not sure what to look for. > > Take out the @ sign so you can see what the PHP error message is. > > ---John Holmes... > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading a file from a form
I am having a problem with uploading a file from a form. I changed the permission on the directory, but I am still getting an error. Here is my error: Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! It looks like it's not finding the file type. Here is my code: ", " "); $this = strtr($this, "<", " "); $this = strtr($this, "|", " "); $$key = $this; } //Check for form fields, insert them. //Pull out the id auto-incremented from previous insert. //Check to see if a full-sized photo was uploaded if ($photo == "none") { echo "No photo."; } else { $end = strrchr($photo_name, "."); echo $end; $new_photo_name = $company_id[0] . $end; if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) { echo "Copy failed."; echo $long_path . "company_logo/" . $photo_name; echo $new_photo_name; } else { $long_photo_path = $long_path . "company_logo/" . $new_photo_name; $photo_path = $short_path . "company_logo/" . $new_photo_name; if ([EMAIL PROTECTED]($long_path . "logo/" . $photo_name, $long_photo_path)){ echo "Full sized photo not renamed."; } } } $add_image_query .= "UPDATE apt_company_t set company_logo_path='$photo_path', "; $add_image_query .= "WHERE company_cd = $company_id[0]"; mysql_query($add_image_query) or die("Update Failed!"); } } ?> > Use the Browse button to locate your file on your computer or local network. Company Logo File: Any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] uploading a file from a form
I'm not sure what that means...how do I use it, and where? On Fri, 25 Jul 2003, Marek Kilimajer wrote: > Don't you need to use $HTTP_POST_FILES array because you have > register_globals off? > > Amanda McComb wrote: > > > I am having a problem with uploading a file from a form. I changed the > > permission on the directory, but I am still getting an error. Here is my > > error: > > > > Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! > > > > It looks like it's not finding the file type. Here is my code: > > > > > > > $long_path = "/home/vencel/www/images/apt/"; > > $short_path = "../images/apt/"; > > > > if (($REQUEST_METHOD=='POST')) { > >for(reset($HTTP_POST_VARS); > > $key=key($HTTP_POST_VARS); > > next($HTTP_POST_VARS)) { > > $this = addslashes($HTTP_POST_VARS[$key]); > > $this = strtr($this, ">", " "); > > $this = strtr($this, "<", " "); > > $this = strtr($this, "|", " "); > > $$key = $this; > >} > > > > > > //Check for form fields, insert them. > > > > //Pull out the id auto-incremented from previous insert. > > > > > > //Check to see if a full-sized photo was uploaded > > if ($photo == "none") { > > echo "No photo."; > > } else { > > $end = strrchr($photo_name, "."); > > echo $end; > > $new_photo_name = $company_id[0] . $end; > > > > if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) { > > echo "Copy failed."; > > echo $long_path . "company_logo/" . $photo_name; > > echo $new_photo_name; > > > > } else { > > $long_photo_path = $long_path . "company_logo/" . $new_photo_name; > > $photo_path = $short_path . "company_logo/" . $new_photo_name; > > > > if ([EMAIL PROTECTED]($long_path . "logo/" . $photo_name, > >$long_photo_path)){ > >echo "Full sized photo not renamed."; > > } > > } > > } > > $add_image_query .= "UPDATE apt_company_t set > > company_logo_path='$photo_path', "; > > $add_image_query .= "WHERE company_cd = $company_id[0]"; > > > > mysql_query($add_image_query) or die("Update Failed!"); > > > > > > } > > } ?> > > > > > > > > > Use the Browse button to locate your file on > > your computer or local network. > > > > > > Company Logo File: > size="30"> > > > > > > > > > > > > > > > > Any ideas? > > > > > > > > > > > -- > 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] uploading a file from a form
The version is PHP Version 4.2.3. On Tue, 29 Jul 2003, Tom Rogers wrote: > Hi, > > Friday, July 25, 2003, 1:48:50 AM, you wrote: > AM> I am having a problem with uploading a file from a form. I changed the > AM> permission on the directory, but I am still getting an error. Here is my > AM> error: > > AM> Copy failed./home/vencel/www/images/apt/company_logo/14Update Failed! > > AM> It looks like it's not finding the file type. Here is my code: > > AM> > AM> AM> $long_path = "/home/vencel/www/images/apt/"; > AM> $short_path = "../images/apt/"; > > AM> if (($REQUEST_METHOD=='POST')) { > AM>for(reset($HTTP_POST_VARS); > AM> $key=key($HTTP_POST_VARS); > AM> next($HTTP_POST_VARS)) { > AM> $this = addslashes($HTTP_POST_VARS[$key]); > AM> $this = strtr($this, ">", " "); > AM> $this = strtr($this, "<", " "); > AM> $this = strtr($this, "|", " "); > AM> $$key = $this; > AM>} > > > AM> //Check for form fields, insert them. > > AM> //Pull out the id auto-incremented from previous insert. > > > AM> //Check to see if a full-sized photo was uploaded > AM> if ($photo == "none") { > AM> echo "No photo."; > AM> } else { > AM> $end = strrchr($photo_name, "."); > AM> echo $end; > AM> $new_photo_name = $company_id[0] . $end; > > AM> if ([EMAIL PROTECTED]($photo, $long_path . "company_logo/" . $photo_name)) > { > AM> echo "Copy failed."; > AM> echo $long_path . "company_logo/" . $photo_name; > AM> echo $new_photo_name; > > AM> } else { > AM> $long_photo_path = $long_path . "company_logo/" . $new_photo_name; > AM> $photo_path = $short_path . "company_logo/" . $new_photo_name; > > AM> if ([EMAIL PROTECTED]($long_path . "logo/" . $photo_name, > AM>$long_photo_path)){ > AM>echo "Full sized photo not renamed."; > AM> } > AM> } > AM> } > AM> $add_image_query .= "UPDATE apt_company_t set > AM> company_logo_path='$photo_path', "; > AM> $add_image_query .= "WHERE company_cd = $company_id[0]"; > > AM> mysql_query($add_image_query) or die("Update Failed!"); > > > AM> } > } ?>> > AM> > > AM> > AM> > AM> Use the Browse button to locate your file on > AM> your computer or local network. > > AM> > AM> Company Logo File: size="30">> > > AM> > AM> > AM> > AM> > AM> > > AM> Any ideas? > > The first thing is to add ENCTYPE="multipart/form-data" to the form > tag. > > > > > Then the rest will depend on what version of php you have. > > It may be worth doing print_r($_FILES); to see if that is available. > > -- > regards, > 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
[PHP] downloading a file using headers
I have a page that queries the database then uses the data to build an excel spreasheet. THat spreadsheet is downloaded according to info in the headers. My manager wants to put the page inside of another HTML page to make it prettier, but then it breaks because headers are already written (it's included in the other HTML page). It works fine on it's own, but he really wants it in that page. He wants to know if there is a way to trick it into working. Any ideas? I can post the code if necessary, but it's lng and messy. THanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using mail()
If I am using this code: mail("[EMAIL PROTECTED]", "test", "testbody"); and want to add a From: line, how do I do it? Also, is this an excepted way of sending mail from a web page? Thanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking how many records are returned?
Is there a way to check how many records are returned from a query to the database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] bug in code - can't find it!
Oh, yeah. Well, I just copied and pasted that from another form. Taken out, it still doesn't work. Even the echo, which is on no way related to the checkbox. Thanks! On Wed, 6 Aug 2003, Chris Sherwood wrote: > VALUE="CHECKED"> $search_result2[a.retired_flag]?> > } > > well for starters checkboxes dont have a size and maxlength > you may want to try that and see if it works... > > > > ----- Original Message - > From: "Amanda McComb" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, August 06, 2003 2:47 PM > Subject: [PHP] bug in code - can't find it! > > > > Ok, after all of the discussion on posting, I'm afraid to post. > > Unfortunately, no one I know is a programmer, and I am a beginner. I can > > normally figure out what I've done wrong, but I'm missing something here. > > > > Ok, here is my query and the bit of code I can't figure out: > > > > $query = "SELECT * from apt_user_t a, apt_company_t b "; > > $query .= "WHERE a.user_cd = b.user_cd "; > > $query .= "ORDER BY a.username"; > > > > $search_results = mysql_query($query) or die("Select > > Failed!"); > > while ($search_result2 = mysql_fetch_array($search_results)) > > { > > > TYPE="checkbox" > > NAME="" > > SIZE="20" > > MAXLENGTH="50" > > VALUE="CHECKED"> $search_result2[a.retired_flag]?> > > } > > Nothing shows up with the echo or the value. I only included this > > checkbox, but all of the other values show up fine. Can someone give me a > > hint? > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] bug in code - can't find it!
Ok, after all of the discussion on posting, I'm afraid to post. Unfortunately, no one I know is a programmer, and I am a beginner. I can normally figure out what I've done wrong, but I'm missing something here. Ok, here is my query and the bit of code I can't figure out: $query = "SELECT * from apt_user_t a, apt_company_t b "; $query .= "WHERE a.user_cd = b.user_cd "; $query .= "ORDER BY a.username"; $search_results = mysql_query($query) or die("Select Failed!"); while ($search_result2 = mysql_fetch_array($search_results)) { } Nothing shows up with the echo or the value. I only included this checkbox, but all of the other values show up fine. Can someone give me a hint? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stop neurotic posting
I am definitely a novice, and I use the online manual, but a lot of times I won't even know what to search for, or I'll search for something and not find what I'm looking for, or I'll find what I think I'm looking for, then pour over some unclear examples and text and realize it's NOT what I'm looking for. I love that I can shoot off a question while at work and get an answer quick. It's too bad that my novice questions annoy people, but I'm just learning, and that's WHY I joined this list. It's a resource, just like the manual. And as for Google, I don't feel like I have time to wade through pages and pages of irrelevant links until I find what I'm looking for when I have a better resource right here. On Wed, 6 Aug 2003, Step Schwarz wrote: > The manual (especially user comments) and Google are invaluable to me as a > PHP coder. As fast as this list is to respond to a very basic question, the > manual and Google are faster. And more in-depth. So no offense but the > replies you consider to be neurotic I consider to be helpful. -Step > > > This is a very busy list, over 100 message in a quiet day and most people > > are helpful and decent, don't mind reading and learning. Unfortunately > > there are some who mostly post stuff like 'read the manual' and other shit > > like that. Stuffing e-mailboxes with such garbage day after day doesn't do > > anybody any good even if the manual is not being read as much as it should > > be. Is it too difficult to not answer the post at all if you disagree with > > the content? > > > > > > Andu > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] math functions?
I am having trouble finding math functions on php.net. I am also getting "page not found" errors when trying to search. Basically, I'm looking for a mod or division function - something I can use to tell me when a number is evening divisable by a certain number. Thanks! Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] math functions?
The reason was because we are having intermittent network problems and I was unable to search for it. That's why I was asking for a place to find math functions. I also asked for a "mod" function, which in most languages is short for modulus. On 26 Aug 2003, Robert Cummings wrote: > Is there some reason you can't use the modulus operator? > > http://www.php.net/manual/en/language.operators.arithmetic.php > > Cheers, > Rob. > > > On Tue, 2003-08-26 at 11:07, Amanda McComb wrote: > > I am having trouble finding math functions on php.net. I am also getting > > "page not found" errors when trying to search. > > > > Basically, I'm looking for a mod or division function - something I can > > use to tell me when a number is evening divisable by a certain number. > > > > Thanks! > > Amanda > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > .-. > | Worlds of Carnage - http://www.wocmud.org | > :-: > | Come visit a world of myth and legend where | > | fantastical creatures come to life and the | > | stuff of nightmares grasp for your soul.| > `-' > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] math functions?
Perfect! Thanks! On Tue, 26 Aug 2003, CPT John W. Holmes wrote: > From: "Amanda McComb" <[EMAIL PROTECTED]> > > > > I am having trouble finding math functions on php.net. I am also getting > > "page not found" errors when trying to search. > > > > Basically, I'm looking for a mod or division function - something I can > > use to tell me when a number is evening divisable by a certain number. > > % is mod, / is division... > > $a = 10; > $b = 5; > > if($a % $b == 0) > { echo "evenly devisable"; } > > Arithmetic Operators: > http://us2.php.net/manual/en/language.operators.arithmetic.php > > Math Functions: > http://us2.php.net/manual/en/ref.math.php > > BCMath Functions > http://us2.php.net/manual/en/ref.bc.php > > ---John Holmes... > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with page loading
Hello! I am working on a site that I thought was working just fine - I tested it in Netscape 7 and IE. However, several people trying to access it using Netscape 4.7 have been having problems. Specifically, there is a search that returns linked results. The link transfers the result's id to the page that displays all of the data. That works fine IF the result person has no books assigned to them. If they do, the page is blank. However, if you hit return or refresh the page, everything shows up fine. If you view the source, all of the info is there, but it's just not displaying. Here is the link to the site: http://tillergroup.com/test/ This person has a book, and therefore produces the problem (on Netscape 4.7): http://tillergroup.com/test/speaker_full.php?speaker_id=29 This person does not have a book, and the page loads fine without refreshing: http://tillergroup.com/test/speaker_full.php?speaker_id=60 The page is huge, so I hate to send the code for the whole page unless someone wants to see it. I am desperate for help! Thanks!! Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] spawning new window with PHP
I have a list of urls in a MySQL database and I use PHP to get them out. I need to spawn a new window and use one of those URLs as the location for the new window. Is there PHP code that can do this? Here is part of the javascript I currently use: lastwin=window.open(); lastwin.location="http://www.google.com";; if (jsversion >= 1.2) { lastwin.moveTo(0,0); lastwin.resizeTo(screen.availWidth,screen.availHeight); lastwin.focus(); } this.window.resizeTo(600, 400); this.window.focus(); if PHP can't do this, is there a way to create a variable in PHP that can be used in javascript? THanks, Amanda -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form name and submit test
If I have multiple forms on a page, and each form has it's own name, how can I tell which form has submitted? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] can't figure out how to get this dynamic dropdown to work correctly
I have a form with two dynamic dropdowns that submit the form when an option is chosen. There is also a button at the bottom of the form that submits the form. The first drop down is a list of all customers. The user chooses a customer, and a query is run that populates all of the fields (mostly text fields) of the form with that customer's data. There is another drop down that contains a list of all of the conferences. I have the form working enough that the conference in the drop down that is selected is the conference that customer bought. The user should be able to edit anything, including the conference, and push the button at the bottom to save the changes. So far, everything works correctly except for the second drop down - the conference drop down. When the user picks a new conference from the drop down, the form submits, but the option that is selected is not the option the user just chose, but the one that is saved in the database. If I change the if statement within the drop down code, I can get it to select the new conference that the user selected, but then that particular conference is always selected, no matter which customer is selected from the first drop down, and it should change depending on what is in the database. I am trying to create an if statement that captures exactly what needs to happen, but I am at a loss. Basically, any time a new name is chosen from the drop down, the database value should be displayed. Otherwise, the form value should be displayed. But I'm not sure how to determine if a new name has been selected. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] make a variable not exist?
Is there a way to make a variable not exist? There are several places where I test (!$variable), and I want to be able to change the variable to pass that test, even though it exists, under certain circumstances. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php