filenames

Reusing the temporary file created by a file upload in a PHP form

旧时模样 提交于 2019-12-10 15:48:26
问题 regarding file uploads, I have a form through which I upload a file, I get the $temp_name = $_FILES['name']['temp_name'] and store it in a variable. Can I then use that variable again inside move_uploaded_file("$temp_name","$location") inside another form. Will this work?? When we upload a file, there is a temp location created on the server. How long can the temporary file be used for? Thanks. 回答1: You can only use that name in the script which receives the upload since the temporary file

How to get the path part of a filename?

橙三吉。 提交于 2019-12-10 14:58:50
问题 I want to get the path part of a file name in MATLAB like dirname and basename in Linux. I've tried to turn to find a function like strrchr, but I failed. I know strtok , strfind and textscan can be used, but I want to accomplish this with not more than two statements. 回答1: For this particular problem I suggest you use the fileparts function: [path, filename, extension] = fileparts(str) 回答2: Nick's answer definitely does what you ask for, but here's an alternative answer using regexprep:

How to map filenames to RDD using sc.textFile(“s3n://bucket/*.csv”)?

家住魔仙堡 提交于 2019-12-10 14:51:02
问题 Please note, I must use the sc.textFile, but I would accept any other answers. What I want to do is to simply add the filename that is being processed to RDD.... some thing like: var rdd = sc.textFile("s3n://bucket/*.csv").map(line=>filename+","+line) Much appreciated! EDIT2: SOLUTION TO EDIT1 is to use Hadoop 2.4 or above. However, I have not tested it by using the slaves... etc. However, some of the mentioned solutions work only for the small data-sets. If you want to use the big-data, you

Changing name of the uploaded file in CodeIgniter (dots & underscores)

与世无争的帅哥 提交于 2019-12-10 13:16:48
问题 I got some problems with changing name of uploaded file: $config = array( 'allowed_types' => 'mp3', 'file_name' => $fulltitle, // Lets say we've entered 'a.s.d.f.mp3' 'upload_path' => './music/' ); $this->load->library('upload', $config); $this->upload->do_upload(); But, when I check my filename it shows me a.s_.d_.f_.mp3 Why CodeIgniter add underscore before every dot after first one? How I can disable this? Thank you. ADDED Well I found solution. system->libraries->Upload.php file. Line 994

How do I copy a file with a UTF-8 filename to another UTF-8 filename in Perl on Windows?

半世苍凉 提交于 2019-12-10 12:59:23
问题 For example, given an empty file テスト.txt , how would I make a copy called テスト.txt.copy ? My first crack at it managed to access the file and create the new filename, but the copy generated テスト.txt.copy . Here was my first crack at it: #!/usr/bin/env perl use strict; use warnings; use English '-no_match_vars'; use File::Basename; use Getopt::Long; use File::Copy; use Win32; my ( $output_relfilepath, ) = process_command_line(); open my $fh, '>', $output_relfilepath or die $!; binmode $fh,

Extracting File Extensions from AppleScript Paths

白昼怎懂夜的黑 提交于 2019-12-10 10:59:49
问题 I'm writing an Apple Script that ultimately will mark commercials for all iTunes exports from EyeTV. But I'm running into a simple problem with AppleScript paths, which the EyeTV app returns as recording locations. Here's the context: set recordingID to 370404006 set myid to recordingID as integer tell application "EyeTV" set eyetvr_file to get the location of recording id myid as alias end tell return eyetvr_file alias "Macintosh HD2:Documents:EyeTV Archive:South Park.eyetv:000000001613eaa6

Vaadin: Downloaded file has whole path as file name

喜你入骨 提交于 2019-12-10 10:56:12
问题 I have a download action implemented on my Vaadin application but for some reason the downloaded file has the original file's full path as the file name. Any idea? You can see the code on this post. Edit: Here's the important part of the code: package com.bluecubs.xinco.core.server.vaadin; import com.bluecubs.xinco.core.server.XincoConfigSingletonServer; import com.vaadin.Application; import com.vaadin.terminal.DownloadStream; import com.vaadin.terminal.FileResource; import java.io.*; import

Handling UTF filenames in Python

爷,独闯天下 提交于 2019-12-10 09:43:21
问题 I've read quite a bit on the topic already, including what seems to be the definitive guide on this topic here: http://docs.python.org/howto/unicode.html Perhaps for a more experienced developer, that guide may be enough. However, in my case, I'm more confused than when I started and still haven't resolved my issue. I am trying to read filenames using os.walk() and to obtain certain information about the files (such as filesize) before writing that information to a text file. This works as

C# Get Path/Filename by Handle (hWnd) 32 and 64bit

本秂侑毒 提交于 2019-12-10 09:06:48
问题 I got the following code to get path/filename by handle: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int GetWindowThreadProcessId(IntPtr handle, out uint processId); public static string GetProcessPath(IntPtr hwnd) { uint pid = 0; GetWindowThreadProcessId(hwnd, out pid); Process proc = Process.GetProcessById((int)pid); return proc.MainModule.FileName.ToString(); } it works perfect in 32 bit but I get error in 64bit > "Only part of the

how to insert filename without the path in vim

匆匆过客 提交于 2019-12-10 03:56:18
问题 I knew that in the insert mode i can insert the filiename with the path using CTRL-R - % . But i'd like to insert only the filename without the path part. Is there a similar command for that? 回答1: You can use <C-r>=expand("%:t")<CR> See :help filename-modifiers . Edit <C-r> is used in insert mode to insert the content of a register. "% is the register that contains the name of the current file. "= is the expression register, it contains the result of the expression that comes after = : <C-r>