How To Create A File Using PHP ?
How to create a file using PHP ?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can Php Create A New Txt File?
I'm trying to build an e-card page for a client using php, but they don't want to use a mySQL database, so I was wondering if PHP can create new text files when someone enters their information into a form and then the recipient gets an email with that txt file reference in a link and can then go to a page that populates with that particular text. Does it sound like I'm on the right path?
Can't Create New File
I have a small PHP script that will convert text into vcard format and write it to a new .vcf file (plain text). To write, I've used PHP Code:
Cannot Create File When Uploading
Hi. I use this script to upload file (taken by Zend.com website) This works locally, but when i upload to server i get an error. script... //$campofile is the file field filled before in a form... $archive_dir = "../folder1"; $filename = basename($campofile_name); $filesize = basename($campofile_size); $filetype = basename($campofile_type); if($campofile!='') { if(!copy($campofile,"$archive_dir/$filename")) echo "Error: $filename could not be uploaded."."<br>"; } After executing that script i get this error:
Create A Csv File On-the-fly For Downloading
I have a large database-created table on a page, that needs to have a "download as csv file" link (actually, as xcel, but I'll bet that's much harder to create). What's the simplest way to do that? Do I actually delete-and-recreate a csv file on the server every time?
Cannot Upload And Create File
I've written this script to upload files to my server, and if the file being uploaded is an image file, a thumbnail is automatically created along with it. But right now, after you select the file, and hit upload, you are brought to a blank screen. I check the directories, and the files are not uploaded. Everything LOOKS right, I just don't know what's wrong. PHP Code:
How Do I Create An Url That Downloads An Mp3 File?
i want to write a script that lets me create a url that downloads an mp3 file like this: http://domain.com/songs.php?m=killerfx and have that goto this file http://domain.com/music/abc.mp3 this is what I have so far, could someone help me with the missing part? <?php $m = $_GET['m']; $file = 'music/'.$m.'.mp3';?>
Create Downloadable Xml File
I need to make a downloadable xml google sitemap based off of mysql data. What fuctions would I use. I assume I would be using fopen to write it, but how do I make it downloadable. I don't want there to be a copy of it on the server (permissions wouldn't allow it anyway), I just want people to hit a button, generate the file, and download it.
Create A Table Regarding A Text File
I have this .txt file : Roger|tow25$rank259 Isabelle|tow36$rank24 Pascal|tow12$rank29 Sergeï|tow45$rank5 Michel|tow1245$rank45478 Frédéric|tow1$rank125425 And this programm php3 <?php $fichier = "classeur.txt"; if($fp = fopen($fichier,"r")){ $ligne=1; echo "<table border=1 bordercolor="#00CCFF" width=500> "; echo "<tr align=center><td colspan=3>TITRE</td>"; while (!feof($fp)) { list( $name, $tampon ) = explode( "|tow", $fp ); list( $tow, $obj ) = explode ( "$rank", $tampon ); echo " <tr>"; echo "<td align=center><b>Nom".$name."</b></td><td>Tow".$tow."</td><td>Obj".$obj."</td[color=blue] >";[/color] echo "</tr> "; $ligne++; echo "</table> "; echo "$cell"; fclose($fp); }else{ echo "Error : open impossible ".$fichier; exit(); } ?> I would like to past each value of the lines in the tex file, in 3 variables $nom; $tow; $obj and create a table with 3 column ( column 1 the name, in 2 the tow, and in 3 the obj)
Script To Create Html File
I'm looking for a php script that will look in my images folder and for each image in there, create an html file named <imagename>.html and store it in a folder called "pages". I currently use the code inserted below that scans my image folder, creates an xml file that contains a list of the images and the my Flash image gallery reads the xml file to create the gallery. but I would rather do it by the method I'm requesting above and get away from flash. Any ideas? Even if there's a way to modify the code below to do what I want, that would be great. Code:
Create Db Firebird With Php, Exec Does Not Want To Execute A File .bat
I am trying to create db firebird with php, script php generates and executes a file .bat . the file .bat creates db using isql in c:firebirdin, but .bat does not create db when is called by php script, but the file .bat if it works when it is executed from MSDOS, creates db correctly, the question is ¿why the file .bat creates the data base when it is executed by MSDOS but it does not work when is executed by exec in php script? as php script can execute .bat to create db? PHP Code:
How Do You Create A New Line Each Time A File Is Written To?
I am trying to write user submitted information to a file, and I am having a little problem. Here is my code: <?php import_request_variables($_POST, "FirstName"); $file=(/fname.dat'); $f=fopen($file,'a'); fwrite($f,$FirstName); fclose($f);?> Each time the file gets written to, the info is just tacked right after the last character from the previous entry. How can I get this to write each entry on a seperate line?
PHP Script To Create MySQL DB From A Dump FIle
I just need to write a script that will read a dump file and just create the tables, ect. as specified from it. If anyone has a link or some simple code for this that would be great. Didn't think about this till i had done it, but i have the mysql create commands over multiple lines, so I can't just use: while (list($lineNum, $line) = each($dumpFile)) { mysql_query($line);}
Using Fopen() To Create New File - Works For A Few Then Just Doesnt
I am currently working on a content management system where a user can fill in a form (title, keywords, link text etc. - all the initial attibutes), which when submitted, will go onto create a web page. The code is as follows: $html = "<html> <body> <p>Hello World</p> </body> <html>"; $handle = fopen($_SERVER['DOCUMENT_ROOT']."/path/to/folder/".$filename, "w"); fwrite($handle, $html); fclose($handle); Pretty basic, I think. I works for a few and then it just stops. I get no error to say that 'could not create file' or 'file not found', it just submits. Any reason for this? I have tried searching the C: drive for the file but it cannot be found. At the moment Im trying to figure out when it actually occurs but for some annoying reason, it seems to be working now. I would prefer to be assured that it wont occur again so just thought I would still post something here just encase this problem is a known one. Is fopen() the best solution for creating files? I was aware that it was used to open an existing file but create one (?). Is this what it was intended to do? Im sure it is, but its new to me.
Create A Search Result On A File Directory
I am working on a project where I need to take a variable from a form, then match that variable against a directory list and return a modified list of files available that are clickable. I have created the form - (easy part) and I have found coding that pulls the directory list. I am having trouble finding information on how to take that directory list a sort the results based only on the keyword that was typed in.
Read Off An Uploaded File Name To Create A Link?
I want to read an uploaded filename, say "mypic.jpg" to create a link to this image without having to ask the users to enter the filename "mypic.jpg" when uploading it. My upload code works file but it's not on the same page. I'm working on my "index.php" page and included the upload.php page "<?php include("upload.php"); ?>" in it. Here's the sample of my code in the upload.php page (the code for the form is separate and not included here): Code:
Upload File And Create Directory For Each User?
I just saw an interesting thread, for uploading files - but my problem is just to add a directory for each user, the user name are stored in session variable sess_uname? I am not sure how do i check if the directory is already exists for the logged user. if directory exists than i i just want to move the file to that directory otherwise create directory with the name as sess_uname and store the file. Code:
PHP5, Win2003, Create Any File Or Folder On The Server
If I create any file or folder on the server and run the php file it works with no problem. As soon as I copy a website from another server onto this one none of the php code works and the browser only shows the actual php code. Is there a permission I need to set? I have never had this problem...
Need To Create Drop Down Box With Data Pulled From Text File
Trying to make a drop down box like this example: Dog Cat Bird But sometimes I will need to update it...and add/remove names from the list. I want to do it fast and easy and I don't want to use a MySQL Database. I'd rather use a text file...can that be done? I would keep the info in a text file and then push it to a drop down box via php and html.
Can I Create .exe File Of My .php File
is there any way using which i can create .exe file of my php files. actually i am putting my php files on a web server and i don't want my files to be copied and modified by someone else/even not by administrator of web server. if i am putting php files then administrator has right to copy file and he may modify it as per his requirements.. if i put exe file then he can't modify file.
Create Rss Xml
I'm currently working on creating the xml feed since I had data ready in my database after web data extraction. However, it has errors for this line: <xml version="1.0" encoding="ISO-8859-1"> I was unable to solve this. <html> <head> <title>MMU RSS FEED</title> </head> <body> header("Content-type: application/xml"); <xml version="1.0" encoding="ISO-8859-1"> <rss version ="2.0"> <channel> <title>MMU RSS FEED Today: <?php echo date("D, d-M-Y H:i:s")?></ title> <link>http://bulletin.mmu.edu.my/</link> <description>MMU RSS FEED</description> <ttl>60<ttl> <?php //connect to database $db = mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("bulletin", $db) or die(mysql_error()); $day = date("Y-n-j"); //select queries $sql = "SELECT * FROM `bul_data` WHERE `DATE` LIKE '{$day}%' ORDER by `DEPARTMENT`"; echo "sql=".$sql; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res)>0) { while($row=mysql_fetch_assoc($res)) { $date = $row['DATE']; $title = $row['TITLE']; $department = $row['DEPARTMENT']; $link = $row['LINK']; //output to browser echo "<item>"; echo "<title>$title</title>"; echo "<category>$department</category>"; echo "<link><a href="$link">$link</a></link>"; echo "</item>"; } echo "</table>"; } ?> </channel> </rss> </body> </html>
Create Php.ini
The support of hosting contracted indicates that I must create a file php.ini in the folder wwwroot/in which I indicate the new directors for the values of upload_max_size, memory_limit, post_max_size, max_input_time, max_execution_time to me which I need. Using the function ini_set. The truth I have proven of many forms and it does not manage to do it if somebody knows to use this function or similar configuration I thank for them.
Create Directories On The Fly...
Just curious to know is it possible to create directories on the fly? What I have done is created a script when you can add categories and subcategories, but what I would like to do is create a directory physcially within that category. For instance using the mkdir command using linux. In a way traversing through and creating a directory. An example would be: If I created a category called business and econony then it would display this in the address bar. http://www.domain.com/Business_and_Economy Then perhaps under Business and Economy, a category called Accounting, then it would display the following: http://www.domain.com/Business_and_Economy/Accounting/ Hopefully I'm making some sense here. Heres the code: function maketree($rootcatid,$level) { $sql="select catid,cat_name from quiz_category where parentid=$rootcatid order by cat_name"; $result=mysql_query($sql); while (list($DBcatid,$DBcatname)=mysql_fetch_row($result)) { $width=($level+1)*24; $display="<img src=http://www.domain.com/spacer.gif border=0 width=$width height=12>"; if ($DBcatid==1) { $display.="<input type="radio" name="quest_type" value=$DBcatid checked>"; } else { $display.="<input type="radio" name="quest_type" value=$DBcatid>"; } $display.="$DBcatname<br> "; echo $display; maketree($DBcatid,$level+1); } } if ($submit=='Add New Category') { if ($new_cat!='') { mysql_query("insert into quiz_category (parentid,cat_name) values ($quest_type,'$new_cat')"); # need to create directory here echo "<br><br><center><b>New category entered</b></center>"; } else echo "<br><br><center><b>New category name must be entered</b></center>"; }
Using Php To Create .htaccess
if you have a form with two variables, USER and PASS, how do you encode them to the format for a .htaccess password protection file?
Cannot Create A URL With Two Variables
I wish to create a url with two variables from data passed from a previous page. If I allocate text to the variables on the page, like $linkaddress = (񟡂'); $clientsemail = ('olympic@mechan.freeserve.com'); the full correct URL is echoed back thus http://www.morgle.com/mymorglemailer.php?mylinkaddress=1234&calledemailaddress=olympic@mechan.freeserve.com However, if I try and create the URL with the variables posted from the previous page , the URL is truncated after the first variable thus http://www.morgle.com/mymorglemailer.php?mylinkaddress=1234 I know the variables being posted from the previous page contain data because I have echoed them back seperately ok.
Create A Timestamp
I have a date YYYY/MM/DD and a houte HH:MM and want to create a timestamp from it. The date is easy but how do I add the time?
Create DB Table
how to create a table in a SQL database using PHP3. I can login via telnet and create a table but that is sorta worthless considering that I'd like to be able to do it via a browser instead. Would someone please post some quick code to point me in the right direction?
Create New Line
I am not sure I post to correct forum or not, anyway, my question is I create some textfield in tabular format (in loop 10 times). Now I want to add function "add new line" where I click ADD, it will create new text field shown in the form, is it possible to do?
Create Database
I have basically an install script that creates a database and all the tables and fields. This works great on the local IIS I have on this machine, but that's because I have 1 password for all databases. THe database cannot be created when I run this on the server that hosts my websites (which is a remote server that I rent space on, it's not in my control). I'm trying to figure out if what I want to do is possible. I want to have a script that creates a database on any server via a web page.
How To Create Site Map?
how to create sitemap? the sitemap i'm having now, if i want to add or modify things, i have to do it in the code.
PHP Create Directory.
im strugling with this for days now... so please help ih you know... it's UNIX server, i'm trying to find working script that would create directories recursively... script is in www.server.com/cp/uploadfiles/script.php and function should be called like 'createDir ("../../files/aa/bb")' -> only "../../files" exists.
SQL Create Table From Pdf
I would like to use a routine which has as input a pdf form file and returns the SQL statement to create the table for a SQL database. Did someone know such a tool?
How To Create An Image On The Fly?
I've created an image with this code Header("Content-Type: image/png"); $image = ImageCreate($W,$H); $white = ImageColorAllocate($image,255,255,255); $black = ImageColorAllocate($image,0,0,0); ImageLine($image,0,0,$W,$H,$black); ImagePng($image); ImageDestroy($image); but now I wish to add a line echo "Hello"; before the image code, then I only get garbage, the header command is probably invalid now. So how do I create the image without having to save the image to a file?
PDF To Create A Picture
Hey is there a way to create a picture of a PDF? Such as a user uploads a PDF. Then I want to display the first page to the PDF as an image. How would I do that without creating an image with photoshop or such like program?
Create/copy
what i want to do is have it when someone signs up it creates a folder with their username on the server and copyies files to that folder....
Create Maps
I'm building a weather web site and want to generate weather maps with php. I just created a database with temps, max, mins, etc.. (easier than I thought, this php stuff is great). Now I want to extract that data and plot them on a map (plot a few cities with their temp and weather icon (.gif file))
Using Php To Create Zip Files
can anyone point me to a resource/tutorial on creating zip files using php? I've gone through 4 tutorials and none have worked. If you've used one that has worked for you that would be a huge help.
How To Create An Array?
how to create an array that contains cat01, cat02,cat03..., cat17 and the cat01 has a value equal to 1, cat02 has a value = 2, cat17 has a value =17 ??? (means every cat01-cat17 has a value assigned to).
|