Jump to content

Search the Community

Showing results for tags 'file'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 6 results

  1. i try this code to rename file when upload , the file name is rename in the folder or physical file .But in the database , it display 'array' not the name of file .How to save file name in the database ? $targetDirg= "folder/pda-semakan/gambar/"; if($_FILES['gambar']['size'] == 0 && $_FILES['gambar']['name'] == ""){ $fileNameg = $gambar; }else{ $fileNameg =explode(".",$_FILES['gambar']['name']); $newfilename= $stIC.'.'.end($fileNameg); $moveg =move_uploaded_file($_FILES["gambar"]["tmp_name"], $targetDirg.$newfilename); }
  2. This is so strange. I have this bit of code that removes the .php extension from pages so that I can visit any page without typing .php at the end. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] The above code has always worked for me before. But for some reason today it stopped working on localhost and the live server(ipage hosting). Do you know why that might be?
  3. Hey guys! I have a page that has multiple forms. I am trying to make a button that will save all the information from each textarea to a different .txt file. IE: textarea1 will save to textarea1.txt textarea2 will save to textarea2.txt textarea3 will save to textarea3.txt etc. I am able to save each individual form via individual submit buttons within each form, but I'd like to make a submit button outside of the other forms that saves all forms to their specific files. The code for one of the individual forms looks like this: <form method="post" action="?"> <h1>Physical Stats</h1> <textarea name="stats"><?php include ('resources/stats.txt'); ?></textarea> <br><input type="submit" name="update_stats" value="Update"/> </form> <?php if (isset($_POST['update_stats'])) { file_put_contents("resources/stats.txt", $_POST['stats']); } ?> Everything above works. And the code for the save all form looks like this: <form method="post" action="?"> <input type="submit" name="update_all" value="Update All"/> <br><br> </form> <?php if (isset($_POST['update_all'])) { file_put_contents("resources/stats.txt", $_POST['stats']); file_put_contents("resources/pro_exp.txt", $_POST['pro_exp']); file_put_contents("resources/pro_awards.txt", $_POST['pro_awards']); file_put_contents("resources/ama_exp.txt", $_POST['ama_exp']); file_put_contents("resources/ama_awards.txt", $_POST['ama_awards']); file_put_contents("resources/references.txt", $_POST['references']); } ?> This is the code I currently have and it's just not working. Right now the above code is actually clearing all of the text files. I'm afraid I'm a complete newb to writing scripts and I'm sure there is some rule about file_get_contents that I'm not aware of. Please help! Thanks!
  4. Say I am uploading an image that gets resized. The resized image is a thumb. I have it's file path saved in the database and the image itself saved in a folder. Originally I was saving both to the database and folder. But now that I think about it, do I have to save the orginal image? Wouldn't I be saving up a lot of space if I only save the thumb image? What do you think?
  5. I need to send a cURL request containing a file to upload as well as a JSON string. I can get a properly formatted request when sending the JSON, but the file is throwing it off. $curl_file_object = '@'.$tmp_name $postData= array( 'JSON'=> json_encode($jsonParams), $reference => $curl_file_object, ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $target); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data;")); curl_setopt($curl, CURLOPT_POST, true); // enable posting curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); // post data curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $response = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); debug($info); Am I the first one needing to send file binary data along with a json string to a server at the same time?
  6. I have the following code $fp = fopen('/output/report_sort.txt', 'w'); if(!$fp) die('Could not create / open text file for writing.'); if(fwrite($fp, $txt1) === false) die('Could not write to text file.'); // Print the totals for each category $data = file('/output/report_sort.txt', FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); usort($data, fn($a, $b)=>substr($a,11,2)<=>substr($b,11,2)); // sort by code number $codes = []; foreach ($data as $d) { $p = strpos($d, ')'); $k = substr($d, 11, $p-10); if (!isset($codes[$k])) { $codes[$k] = 1; } else { $codes[$k]++; } } //echo (join("<br>", $data)); echo ("<font color='blue'><b><h3>Total clicks</h3></b></font>"); foreach ($codes as $code => $total) { printf("%s <font color='red'><b>Total clicks = %d<br></b></font>", $code, $total); } echo "<br />"; which from this data 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Cartagena Murcia 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Nerja Malaga 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Cedar Springs Michigan 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Madrid Madrid 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 03 Resist the Curse (Resiste la Maldición) 11-12-2022.mp3 France 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 23 The Wedding Part 1 (La Boda) 30-7-2023.mp3 Ireland Dublin Leinster 22/09/2023 05 Day of Atonement 2023 (Día de la Expiación) 17-9-2023.mp3 Spain Nerja Malaga 22/09/2023 05 Day of Atonement 2023 (Día de la Expiación) 17-9-2023.mp3 Spain Cartagena Murcia outputs the totals for each category as follows 03 Resist the Curse (Resiste la Maldición) Total clicks = 2 04 Feast of Trumpets 2023 (Fiesta de las Trompetas) Total clicks = 19 05 Day of Atonement 2023 (Día de la Expiación) Total clicks = 32 06 Feast of Tabernacles 2023 (Fiesta de los Tabernáculos) Total clicks = 4 07 The Eighth Day 2023 (El Octavo Día) Total clicks = 17 19 The Bread of Life (El Pan de la Vida) Total clicks = 20 20 Be With Me Where I Am (Está Conmigo Donde Estoy) Total clicks = 4 20 The Legacy of Jesus (El Legado de Jesús) Total clicks = 2 23 The Wedding Part 1 (La Boda) Total clicks = 1 what I would like is to combine lines which are duplicated to show 1 line as 1 click as follows 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Cartagena Murcia 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Nerja Malaga 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Cedar Springs Michigan 05/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Spain Madrid Madrid 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 06/10/2023 03 Resist the Curse (Resiste la Maldición) 11-12-2022.mp3 France 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 United States Edmore Michigan 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 08/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster 09/10/2023 07 The Eighth Day 2023 (El Octavo Día) 1-10-2023.mp3 Ireland Dublin Leinster To be shown in the totals as 03 Resist the Curse (Resiste la Maldición) Total clicks = 1 07 The Eighth Day 2023 (El Octavo Día) Total clicks = 1 the same for all the other categories
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.