LuciBKen
Members-
Posts
35 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
LuciBKen's Achievements
Member (2/5)
0
Reputation
-
Here's my code: <?php // Receiving variables $pfw_ip= $_SERVER['REMOTE_ADDR']; $textfield = addslashes($_POST['textfield']); $textarea = addslashes($_POST['textarea']); $file_Name = $_FILES['file']['name']; $file_Size = $_FILES['file']['size']; $file_Temp = $_FILES['file']['tmp_name']; $file_Mime_Type = $_FILES['file']['type']; $file2_Name = $_FILES['file2']['name']; $file2_Size = $_FILES['file2']['size']; $file2_Temp = $_FILES['file2']['tmp_name']; $file2_Mime_Type = $_FILES['file2']['type']; function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } $uploadFile = $file_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } move_uploaded_file( $file_Temp , $uploadFile); $file_URL = "http://www.hawaiisoccermag.com/html/video/".$file_Name ; $uploadFile = $file2_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } move_uploaded_file( $file2_Temp , $uploadFile); $file2_URL = "http://www.hawaiisoccermag.com/html/video/thumb/".$file2_Name ; //saving record in a text file $pfw_file_name = "videolist.csv"; $pfw_first_raw = "textfield,textarea,file,file2\r\n"; $pfw_values = "$textfield,".str_replace ("\r\n","<BR>",$textarea ).",$file_Name,$file2_Name\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle); The script won't upload to the right directory, and returns no errors, I'm completely lost and my deadline is today. Can someone help? Thanks
-
Can someone that knows something about uploading files from a form please lookk at this code and tell me why it will not upload to the right directory? When I make minor changes, it will upload, but to the wrong directory, as it is coded now, it simply won't upload at all. My directory for the upload permissions are 777. Can anyone help? function RecursiveMkdir($path) { if (!file_exists($path)) { RecursiveMkdir(dirname($path)); mkdir($path, 0777); } } $uploadFile = $file_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } move_uploaded_file( $file_Temp , $uploadFile); $file_URL = "http://www.hawaiisoccermag.com/html/video/".$file_Name ; $uploadFile = $file2_Name ; if (!is_dir(dirname($uploadFile))) { RecursiveMkdir(dirname($uploadFile)); } move_uploaded_file( $file2_Temp , $uploadFile); $file2_URL = "http://www.hawaiisoccermag.com/html/video/thumb/".$file2_Name ; Thanks ahead of time guys!
-
Could someone please tell me how to add a line break in code like this for example: $xml .= "foo=2"; $xml .= "bar"; $xml .= "2U"; I want each line to start on a new line in the output file
-
Can someone check syntax on this line for me?
LuciBKen replied to LuciBKen's topic in PHP Coding Help
Ok, changing the quotes etc... worked, but here's my output file and the pic viewer won't read it! SO how can I get my output code to look like a good xml code file? <?xml version="1.0" encoding="utf-8"?><flash_parameters><preferences> <global> <basic_property movieWidth="310" movieHeight="360" html_title="" loadStyle="Pie"/> <title_property photoTitle="false" photoTitleX="5" photoTitleY="5" photoTitleSize="NULL" photoTitleFont="Verdana" photoTitleColor="0xffffff"/> <music_property path="" stream="false"/> <photo_property topPadding="0" bottomPadding="0" leftPadding="0" rightPadding="0"/> </global> <thumbnail> <basic_property autoHide="true" width="75" height="60" alpha="80" align="right"/> </thumbnail> </preferences><album><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(flip over.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(flip over.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Flip Over"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccer ball.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(soccer ball.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Ball"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccergirl.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(Soccergirl.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Girl"/><slide jpegURL="http://www.hawaiisoccermag.com/uploadtest/photoshow/thumbs/(soccer kick.jpg)" d_URL="http://www.hawaiisoccermag.com/uploadtest/photoshow/slides/(soccer kick.jpg)" transition="8" phototime="15" url="http://www.photograffx.smugmug.com" title="Soccer Kick"/></album></flash_parameters> -
Could any one tell me the real difference in using .= or just =?
-
Can someone check syntax on this line for me?
LuciBKen replied to LuciBKen's topic in PHP Coding Help
Thannks, I'll try it. -
Hey all, I was wondering what the correct syntax would b for this line of code: $xml .= '<slide jpegURL="thumbs/($thumb)" '; here's the whole script: $query = "SELECT * FROM jos_pic_player"; $result = mysql_query($query) OR DIE("Error!!!"); // close connection to db include 'closedb.php'; if ($result) { $xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; $xml .= "<flash_parameters>"; $xml .= '<preferences> <global> <basic_property movieWidth="310" movieHeight="360" html_title="" loadStyle="Pie"/> <title_property photoTitle="false" photoTitleX="5" photoTitleY="5" photoTitleSize="NULL" photoTitleFont="Verdana" photoTitleColor="0xffffff"/> <music_property path="" stream="false"/> <photo_property topPadding="0" bottomPadding="0" leftPadding="0" rightPadding="0"/> </global> <thumbnail> <basic_property autoHide="true" width="75" height="60" alpha="80" align="right"/> </thumbnail> </preferences>'; $xml .= "<album>"; while ($r = mysql_fetch_array($result)) { $title = $r["title"]; $file = $r["file"]; $desc = $r["description"]; $thumb = $r["thumbnail"]; $xml .= '<slide jpegURL="thumbs/($thumb)" '; $xml .= 'd_URL="slides/$file"'; $xml .= ' transition="8" '; $xml .= 'phototime="15" '; $xml .= 'url="http://www.photograffx.smugmug.com" '; $xml .= 'title="$title" '; $xml .= '/>'; } $xml .= "</album>"; $xml .= "</flash_parameters>"; } else { echo "Nothing in the db!!!"; } $filename = 'slides.xml'; $somecontent = "$xml\n"; // Let's make sure the file exists and is writable first. if (is_writable($filename)) { // In our example we're opening $filename in append mode. // The file pointer is at the bottom of the file hence // that's where $somecontent will go when we fwrite() it. if (!$handle = fopen($filename, 'w')) { echo "Cannot open file ($filename)"; exit; } // Write $somecontent to our opened file. if (fwrite($handle, $somecontent) === FALSE) { echo "Cannot write to file ($filename)"; exit; } echo "Success, wrote ($somecontent) to file ($filename)"; fclose($handle); } else { echo "The file $filename is not writable"; } ?> it's in a php file that draws info from a db and places it in a certain area in an xml file. Thanks for the help
-
Thanks! I'll give that a shot.
-
Hi everyone, I was wondering if it was possible to just export certain fields from a mydql database to be written to a csv file? Here is the snippet that writes to the file: $pfw_file_name = "mailinglist.csv"; $pfw_first_raw = "textfield,textfield2,textfield3,emailList\r\n"; $pfw_values = "$textfield,$textfield2,$textfield3,$emailList\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle); Can I just add SELECT * FROM entry_form WHERE newsletter='y'; and get the results that I want? If I can, where should I add this line to the code? Thanks!
-
Hey everyone, I was wondering if it was possible to schedule mysql to automatically export to a csv file daily? Or, am I going to have to write a php script to do it? Any links for tutorials to whichever would be helpful. Thanks!
-
http://bootstrapper.sourceforge.net/ This is a link to the GNU bootstrapper, it is supposed to assemble bootstrap scripts for you.
-
Here's a generic script for writing to a csv file, it should give you what you need. //saving record in a text file $pfw_file_name = "yourfile.csv"; $pfw_first_raw = "textfield,textarea,file,file2\r\n"; $pfw_values = "$textfield,".str_replace ("\r\n","<BR>",$textarea ).",$file_Name,$file2_Name\r\n"; $pfw_is_first_row = false; if(!file_exists($pfw_file_name)) { $pfw_is_first_row = true ; } if (!$pfw_handle = fopen($pfw_file_name, 'a+')) { die("Cannot open file ($pfw_file_name)"); exit; } if ($pfw_is_first_row) { if (fwrite($pfw_handle, $pfw_first_raw ) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } } if (fwrite($pfw_handle, $pfw_values) === FALSE) { die("Cannot write to file ($pfw_filename)"); exit; } fclose($pfw_handle);
-
Well, I have no problem admitting that I was wrong ... and I was. When I removed the '@'s the thing worked beautifully. Thank you! Thank you! Thank you! I am definitely in your debt, I have been trying to get this piece of S**t running for two days, and I have no hair left on my head. Thanks a million teng84!
-
I just noticed that you got that example from w3schools.com, which is fine, but a closer look at my code shows that I am trying to upload two files at once. This is an upload from a form, and the file directory is defined in the code. I'm not sure that the result is going to be any different regardless of the little snippet that I use. If you disagree, let me know, and why?