Solved

rename file (and file extension) on windows

Posted on 2013-02-06
2
265 Views
Last Modified: 2013-02-06
using windows 7
wamp

filename is
1
want to rename to
logo.gif


is there a way to do this with a php script
0
Comment
Question by:rgb192
2 Comments
 
LVL 14

Accepted Solution

by:
Giovanni Heward earned 500 total points
ID: 38860381
Bear in mind you must release any handles to the file before you can rename it.

<?php
    $fileHand = fopen('1', 'r');
    fclose($fileHand);
    rename( '1', 'logo.gif' );
?>

Open in new window


Also, PHP will be running as whatever user your web server runs as, so you may need to grant proper permissions on the relevant file/folder to the web server user.
0
 

Author Closing Comment

by:rgb192
ID: 38860803
thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now