rename

How to change name of uploaded file in php? [closed]

ⅰ亾dé卋堺 提交于 2019-12-23 06:57:57
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have this code to upload jpg files. I need to rename the file that someone uploads to newtexture.jpg'. <?php $demo_mode = false; $upload_dir = 'uploads/'; $allowed_ext = array('jpg','jpeg'); if(strtolower($_SERVER['REQUEST_METHOD']) != 'post'){ exit_status('Error! Wrong HTTP method!'); } if(array_key_exists(

PHP: Rename file before upload

夙愿已清 提交于 2019-12-23 04:36:06
问题 I'm trying to rename each file before uploading to Amazon S3. I am trying to use this exact method of which was answered by @Silvertiger: PHP - upload and overwrite a file (or upload and rename it)? If exists, rename to a random name although somehow it doesn't work. Here is the upload post Parameter from the Amazon S3 Class: public static function getHttpUploadPostParams($bucket, $uriPrefix = '', $acl = self::ACL_PRIVATE, $lifetime = 3600, $maxFileSize = 5242880, $successRedirect = "201",

Batch rename # of week

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 04:32:04
问题 I want to rename a few files using batch. I need it to look like DD.MM.YY - # week randomname , so let's say 2.7.2013-27.week abcdefg.xls So far I'm using for /f "tokens=1-5 delims=/ " %%d in ("%date%") do ( rename "C:\TEST\123.xlsx" %%e%%f%%g.xlsx ) which comes up with DD.MM.YYYY and is perfect for the first part. Can you help with the rest? 回答1: @echo off for /F "tokens=1-5 delims=/" %%d in ("%date%") do ( set ddmmyy=%%e.%%f.%%g set /A dd=1%%e-100, mm=1%%f-100, yy=%%g, yyM1=yy-1 ) rem Get

Batch rename # of week

非 Y 不嫁゛ 提交于 2019-12-23 04:31:07
问题 I want to rename a few files using batch. I need it to look like DD.MM.YY - # week randomname , so let's say 2.7.2013-27.week abcdefg.xls So far I'm using for /f "tokens=1-5 delims=/ " %%d in ("%date%") do ( rename "C:\TEST\123.xlsx" %%e%%f%%g.xlsx ) which comes up with DD.MM.YYYY and is perfect for the first part. Can you help with the rest? 回答1: @echo off for /F "tokens=1-5 delims=/" %%d in ("%date%") do ( set ddmmyy=%%e.%%f.%%g set /A dd=1%%e-100, mm=1%%f-100, yy=%%g, yyM1=yy-1 ) rem Get

Add a suffix to a select group of column names in a dataset

最后都变了- 提交于 2019-12-23 04:19:23
问题 I want to add a suffix to a group of columns in a data set (CTDB). For example I have the following columns and I would like to add "_Child" to the end. This subset is part of a larger dataset with 100+ columns, and I do not want to re-write every single column name. [9] "SCARED_BREATHE" [10] "SCARED_HEADACHE_SCHOOL" [11] "SCARED_DISLIKE_STRANGERS" [12] "SCARED_SLEEP_AWAY_HOME" [13] "SCARED_LIKE_ME" [14] "SCARED_PASS_OUT" [15] "SCARED_NERVOUS" [16] "SCARED_FOLLOW_PARENT" [17] "SCARED_LOOK

Rename TFS 2013 Branch

别等时光非礼了梦想. 提交于 2019-12-23 04:09:41
问题 We are using the release number for TFS branches. I have just created a new TFS branch with an upcoming release number. However, the client has since changed the release number which we would like to keep parallel TFS branch name. The branch is new and no changes have been made to it yet. What issues I can expect if I rename the branch? Is it better to create new branch from main with the new release number? 回答1: A rename is a branch+delete under the covers. You would be best creating a new

git added by them renaming conflict - git recognises the same files in the renamed directory as new files

被刻印的时光 ゝ 提交于 2019-12-23 04:04:35
问题 I've renamed a directory and merged it into my main branch, when merging another branch, git recognises the same files in the renamed directory as new files. I get the merge conflict 'added by them' for the same files in that directory when merging in another's branch: added by them: theirDir/same_file_name.xxx I've renamed the directory in their branch to match and continue to get the 'added by them' conflict. When I try to checkout --ours I get $ git checkout dir/same_file_name.xxx --ours

Python, how can I rename several files based off a list?

…衆ロ難τιáo~ 提交于 2019-12-23 03:35:08
问题 Using python with Windows Im trying to rename several files at once that are in the same folder but I cant use a list to do a rename that is why I get this error when I try my code: os.rename(dirlist[1], words[1]) WindowsError: [Error 2] The system cannot find the file specified Here is the sample code: import os import sys words = os.listdir('C:/Users/Any/Desktop/test') dirlist = os.listdir('C:/Users/Any/Desktop/test') words = [w.replace('E', 'e') for w in words] print words os.rename

Rename and download mp3 file

女生的网名这么多〃 提交于 2019-12-23 02:52:10
问题 for example i have link : http://example.com/song.mp3 and when user download it, file will be renamed to artist-song.mp3 I used this code : <?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://example.com/song.mp3"); header('Content-Disposition: attachment; filename="a-s.mp3"'); exit(); ?> But it doesn't work. What do I need to do? 回答1: http://ie2.php.net/readfile the example in the docs is pretty much what you want. in particular, see the header('Content-Disposition:

PHP: move with rename fails, but combination of copy and unlink works

走远了吗. 提交于 2019-12-23 01:19:12
问题 I am trying to use PHP's rename to move a file to a different folder (and also rename the file in the same step). However, rename always returns false . On the other hand, using a combination of copy and unlink works just fine. What could be causing this? The relevant code looks like this: if (!rename($targetpath, $backuppath)) { // if rename fails, try with copy and delete if (!copy($targetpath, $backuppath)) die("9\nCould not move existing file to backup"); touch($backuppath, filemtime(