Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. How to get PHP to rename files

How to get PHP to rename files

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phpdatabasetutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alschafer
    wrote on last edited by
    #1

    I am in a situation where I need to manage files that multiple users won't rename. I think I can use PHP to make each entry into a database unique by adding a unique tag to the file name but I don't know how to do this. The file name would need to be updated before it was entered into the database and the dump folder. Any suggestions?

    N 1 Reply Last reply
    0
    • A Alschafer

      I am in a situation where I need to manage files that multiple users won't rename. I think I can use PHP to make each entry into a database unique by adding a unique tag to the file name but I don't know how to do this. The file name would need to be updated before it was entered into the database and the dump folder. Any suggestions?

      N Offline
      N Offline
      nickmaroulis
      wrote on last edited by
      #2

      why dont you create a database entry for each file then use the primary key of the database item to rename the file. //get uploaded file //create database entry //name //type ... what ever fields are relevent //get last insert id returns last primary key inserted // rename file to $last_insert_id.xyz rename( old file, last insert id ) th

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups