Jump to content

Search the Community

Showing results for tags 'rename'.

  • 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 need to modify the script to additionally do the following: Once the image is on the server, I want it to duplicate itself, then, rename the new duplicated file to a variable name. (Let's say $TEST . '.jpg' where $TEST = TESTING for this example) My current piece of code: This following piece of code might assist you: PS: I am quite new to PHP. (Introduced to it only about 3 days ago)
  2. ~Sorry for topic title, didn't know what to call it.~ Basically, What I want to do is have an image uploader that renames the file to the user's username. For example: If Jeff went to upload his image and on his computer it was called '38483_fbkn.PNG' I want it to rename the file too 'Jeff.jpg' I've done this before but I honestly for the life of me can't remember how I did it. Any help? Also sorry if wrong section, I'm new here
  3. I am trying to store images in a folder on server. For some reason the images that need to be uploaded should be with their orignal name as uploaded by user i.e they can be changed only wth the original name in it. 1)So how can i put it in folder using php and retrieve it wherever needed whch means the name should be in database. 2)Now in the folder if two files with the same name are uploaded then the latest would overwrite whch should be avoided. Plz could anyone give some way to make ths up.
  4. so I'm in the process of making a .gif uploading website, and this is my code for "upload_file.php". <?php $allowedExts = array("jpg", "jpeg", "gif", "png"); $extension = end(explode(".", $_FILES["file"]["name"])); if ((($_FILES["file"]["type"] == "image/gif")) && ($_FILES["file"]["size"] < 5242880) && in_array($extension, $allowedExts)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br>"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br>"; echo "Type: " . $_FILES["file"]["type"] . "<br>"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br>"; if (file_exists("i/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "i/" . $_FILES["file"]["name"]); echo "Stored in: " . "i/" . $_FILES["file"]["name"]; } } } else { echo "Invalid file"; } ?> How can I add a random image name? Preferably 6-8 digits of only #0-9. That way the image name is simple instead of being specific to capital letters etc. Please be as specific with directions as possible, because I'm still learning PHP, and that's one of the main reasons I'm making this website. P.S. Bonus points if you can tell me how to redirect straight to the image without the page that shows the file info.
  5. Hi everybody ! I have a big problem with my images on my FTP... A friend has uploaded thousands of images with a "+" character in the filename on our FTP. For some reasons, my CMS doesn't support it and I need to change the "+" character by a "_" character, directly on the FTP cause it will rake too much time to download all the images and upload them again. So I need a script (PHP ?) that will go in the right subdirectory and replace the "+" if it exists by the "_" character. Someone could help me ? Thanks, Cedric
  6. I've got a dev server which, for reasons I won't go into, needs to have different .htaccess files for each site (and subfolders within them) within it. But not always. What I need to do is: - For the folder I put the PHP script in, and every folder under it (the whole tree under it): - If there's a .htaccess file an no .htaccess.dev file, copy .htaccess and name the copy .htaccess.dev (and look in subfolders) If there's a .htaccess file and also a .htaccess.dev file, do nothing (but keep looking for subfolders) If there's neither a .htaccess or .htaccess.dev file, do nothing (but keep looking for subfolders) I'd try to come up with something myself, but getting it wrong will be fairly catastrophic! I'm sure the conditional copy / rename bit is relatively straightforward, but it's the recursive searching of the whole file-system under the script's location that I'm not sure about... Any help greatly appreciated, as always! I have SSH access, if it's easier done that way maybe I'm approaching it wrong?
×
×
  • 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.