Search Results

Search found 3977 results on 160 pages for 'filename'.

Page 3/160 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Symfony file upload - "Array" stored in database instead of the actual filename

    - by Guillaume Flandre
    I'm using Symfony 1.4.4 and Doctrine and I need to upload an image on the server. I've done that hundreds of times without any problem but this time something weird happens : instead of the filename being stored in the database, I find the string "Array". Here's what I'm doing: In my Form: $this->useFields(array('filename')); $this->embedI18n(sfConfig::get('app_cultures')); $this->widgetSchema['filename'] = new sfWidgetFormInputFileEditable(array( 'file_src' => '/uploads/flash/'.$this->getObject()->getFilename(), 'is_image' => true, 'edit_mode' => !$this->isNew(), 'template' => '<div id="">%file%</div><div id=""><h3 class="">change picture</h3>%input%</div>', )); $this->setValidator['filename'] = new sfValidatorFile(array( 'mime_types' => 'web_images', 'path' => sfConfig::get('sf_upload_dir').'/flash', )); In my action: public function executeIndex( sfWebRequest $request ) { $this->flashContents = $this->page->getFlashContents(); $flash = new FlashContent(); $this->flashForm = new FlashContentForm($flash); $this->processFlashContentForm($request, $this->flashForm); } protected function processFlashContentForm($request, $form) { if ( $form->isSubmitted( $request ) ) { $form->bind( $request->getParameter( $form->getName() ), $request->getFiles( $form->getName() ) ); if ( $form->isValid() ) { $form->save(); $this->getUser()->setFlash( 'notice', $form->isNew() ? 'Added.' : 'Updated.' ); $this->redirect( '@home' ); } } } Before binding my parameters, everything's fine, $request->getFiles($form->getName()) returns my files. But afterwards, $form->getValue('filename') returns the string "Array". Did it happen to any of you guys or do you see anything wrong with my code? Edit: I added the fact that I'm embedding another form, which may be the problem (see Form code above).

    Read the article

  • What are possible reasons for java.io.IOException: "The filename, directory name, or volume label sy

    - by Turismo
    I am trying to copy a file using the following code: File targetFile = new File(targetPath + File.separator + filename); ... targetFile.createNewFile(); fileInputStream = new FileInputStream(fileToCopy); fileOutputStream = new FileOutputStream(targetFile); byte[] buffer = new byte[64*1024]; int i = 0; while((i = fileInputStream.read(buffer)) != -1) { fileOutputStream.write(buffer, 0, i); } For some users the targetFile.createNewFile results in this exception: java.io.IOException: The filename, directory name, or volume label syntax is incorrect at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.createNewFile(File.java:850) Filename and directory name seem to be correct. The directory targetPath is even checked for existence before the copy code is executed and the filename looks like this: AB_timestamp.xml The user has write permissions to the targetPath and can copy the file without problems using the OS. As I don't have access to a machine this happens on yet and can't reproduce the problem on my own machine I turn to you for hints on the reason for this exception.

    Read the article

  • php regex filename

    - by Patrick
    Hi, anyone can help me with a preg_match? I'd like to use php's preg_match to determine if an input is a valid filename or not (only the filename + file extension, not the full path). General rules: 1) filename = a-z, A-Z, 0-9 2) extension = 3 or 4 letters Thank you!

    Read the article

  • Missing backslahes in filename using C#

    - by CL4NCY
    Hi, I have a string literal as follows: string filename = @"C:\myfolder\myfile.jpg"; When I use File.Exists(filename) it works most of the time but sometimes I get an error saying the following file doesn't exist: C:myfoldermyfile.jpg Something seems to strip the backslashes out of the filename. This code is sometimes accessed via an ajax request. Does anyone know why/how this could be happening?

    Read the article

  • Flash builder 4 - change output filename using external build-config.xml (not Ant)

    - by Casey
    I'm trying to change the output filename with a config file loaded via the compiler option -load-config. It looks like this in my compiler arguments: -load-config+=build-config.xml. I've tried the following: <flex-config> <o>absolute/path/to/filename</o> </flex-config> and <flex-config> <output>absolute/path/to/filename</output> </flex-config> and <flex-config> <compiler> <o>absolute/path/to/filename</o> </compiler> </flex-config> and <flex-config> <compiler> <output>absolute/path/to/filename</output> </compiler> </flex-config> but none have worked. I'm on a PC using Flash Builder 4. Has anyone else done this? Also, ideally, I want to use a relative path instead of absolute. I can't get this to work either, even if I do so in the "additional compiler arguments" field of the Project configuration. Thanks in advance!

    Read the article

  • Unicode filename to python subprocess.call()

    - by otrov
    I'm trying to run subprocess.call() with unicode filename, and here is simplified problem: n = u'c:\\windows\\notepad.exe ' f = u'c:\\temp\\nèw.txt' subprocess.call(n + f) which raises famous error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' Encoding to utf-8 produces wrong filename, and mbcs passes filename as new.txt without accent I just can't read any more on this confusing subject and spin in circle. I found here lot of answers for many different problems in past so I thought to join and ask for help myself Thanks

    Read the article

  • for line in open(filename)

    - by foosion
    I frequently see python code similar to for line in open(filename): do_something(line) When does filename get closed with this code? Would it be better to write with open(filename) as f: for line in f.readlines(): do_something(line)

    Read the article

  • Extract dates from filename

    - by Newbie
    I have a situation where I need to extract dates from the file names whose general pattern is [filename_]YYYYMMDD[.fileExtension] e.g. "xxx_20100326.xls" or x2v_20100326.csv The below program does the work //Number of charecter in the substring is set to 8 //since the length of YYYYMMDD is 8 public static string ExtractDatesFromFileNames(string fileName) { return fileName.Substring(fileName.IndexOf("_") + 1, 8); } Is there any better option of achieving the same? I am basically looking for standard practice. I am using C#3.0 and dotnet framework 3.5 Edit: I have like the solution and the way of answerig of LC. I have used his program like string regExPattern = "^(?:.*_)?([0-9]{4})([0-9]{2})([0-9]{2})(?:\\..*)?$"; string result = Regex.Match(fileName, @regExPattern).Groups[1].Value; The input to the function is : "x2v_20100326.csv" But the output is: 2010 instead of 20100326(which is the expected one). Can anyone please help.

    Read the article

  • Extract dates from filename(C#3.0)

    - by Newbie
    I have a situation where I need to extract dates from the file names whose general pattern is [filename_]YYYYMMDD[.fileExtension] e.g. "xxx_20100326.xls" or x2v_20100326.csv The below program does the work //Number of charecter in the substring is set to 8 //since the length of YYYYMMDD is 8 public static string ExtractDatesFromFileNames(string fileName) { return fileName.Substring(fileName.IndexOf("_") + 1, 8); } Is there any better option of achieving the same? I am basically looking for standard practice. I am using C#3.0 and dotnet framework 3.5 Thanks

    Read the article

  • [ask][php] find dynamic filename exist

    - by r4ccoon
    hi. i am writing a cache module in php. it tries to write a cache with a $string+timestamp as a filename. i dont have problem with writing the cache. the problem is i do a foreach loop to get the cache that i want. this is the logic that i use for getting the cache foreach ($filenames as $filename){ if(strstr($filename,$cachename)){//if found if(check_timestamp($filename,time())) display_cace($filename); break; } } but when it tries to get and read the cache, it slows the server down. imagine that i have 10000 cache file in a folder, and i need to check for every file in that cache folder. so how do you think the best way of doing this. here i explain again, because even me still dont understand my written question.. :D i write cache file with this format filename_timestamp.. e.g cache_function_random_news_191982899010 in a folder ./cache/ when i want to get the cache, i only pass "cache_function_random_news_" and check recursively on that folder. if i find something with that needle on a file name, display it, and break. but checking recursively on a 10000 files in a folder is not a good thing yeah? please give me your opinion ok, that would clarify more. thanks.

    Read the article

  • Is there a POSIX pathname that can't name a file?

    - by Charles Stewart
    Are there any legal paths in POSIX that cannot be associated with a file, regular or irregular? That is, for which test -e "$LEGITIMATEPOSIXPATHNAME" cannot succeed? Clarification #1: pathnames By "legal paths in POSIX", I mean ones that POSIX says are allowed, not ones that POSIX doesn't explicitly forbid. I've looked this up, and the are POSIX specification calls them character strings that: Use only characters from the portable filename character set [a-zA-Z0-9._-] (cf. http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276); Do not begin with -; and Have length between 1 and NAME_MAX, a number unspecified for POSIX that is not less than 14. POSIX also allows that filesystems will probably be more relaxed than this, but it forbids the characters NUL and / from appearing in filenames. Note that such a paradigmatically UNIX filename as lost+found isn't FPF, according to this def. There's another constant PATH_MAX, whose use needs no further explanation. The ideal answer will use FPFs, but I'm interested in any example with filenames that POSIX doesn't expressly forbid. Clarification #2: impossibility Obviously, pathnames normally could be bound to a file. But UNIX semantics will tell you that there are special places that couldn't normally have arbitrary files created, like in the /dev directory. Are any such special places stipulated in POSIX? That is what the question is getting after.

    Read the article

  • Weird .#filename files on remote ssh-connected systems after mcedit

    - by etranger
    I'm using MacFusion sshfs in combination with Midnight Commander, and when I edit remote text files with mcedit, weird symlinks are created on the remote system. $ ls -l .* lrwxr-xr-x 1 user group 34 Jun 27 01:54 .#filename.txt -> [email protected] where etranger is my local login name, and mbp is a hostname of my notebook running MacOS. symlinks can be removed by running remote rm command, but cannot be deleted on the mac-fuse mounted volume and thus pollutes the filesystem. I cannot figure what part of software is responsible for this, and how I could fix this, any help is appreciated. EDIT: This appears to be mcedit behavior as documented here: https://dev.openwrt.org/ticket/8245 Apparently, sshfs fails to remove symlink to the lock file for some reason (".#" in filename, perhaps), and it pollutes the filesystem. A quick workaround is possible, using another bug of Midnight Commander: editing (F4) the broken symlink effectively converts it to a missing lock file it was supposed to point to, and removes the symlink itself. The newly created file may then be deleted normally. EDIT 2: Unchecking "Follow symlink" in MacFusion apparently allows sshfs to remove dead symlinks, so the problem disappears completely.

    Read the article

  • Set filename character encoding in Putty's PSFTP

    - by lacton
    I am using PuTTY's command line utility psftp.exe to transfer files between a UTF8-configured linux server and a MS Windows PC. File names containing non ASCII characters (e.g., Japanese kana) are corrupted when using the 'ls' or 'get' commands of the psftp utility. I tried to create a saved session from putty.exe with the translation set to UTF8, and use that saved session from psftp.exe (i.e., open saved_session_with_UTF8_translation), but the filename characters were still corrupted. How can I configure psftp.exe so that it uses the right charset for the file names?

    Read the article

  • Create 8.3 name for an existing directory

    - by Chris Karcher
    I have a machine that initially had 8.3 filename creation disabled. However, this was causing issues with some legacy software, so it was re-enabled. I'm wondering if it's possible to go back and "add" 8.3 filenames to certain existing directories. For example, say I have a directory named "C:\name with spaces" and I get the following output when I run "dir /x": C:\>dir /x Volume in drive C has no label. Volume Serial Number is 6873-65B8 Directory of C:\ 04/09/2010 01:57 PM <DIR> name with spaces ... I'd like to somehow add an 8.3 name for the directory without recreating it, and then get the following: C:\>dir /x Volume in drive C has no label. Volume Serial Number is 6873-65B8 Directory of C:\ 04/09/2010 01:57 PM <DIR> NAMEWI~1 name with spaces ... I tried the 'rename' command but it didn't do the trick.

    Read the article

  • How to force Windows XP to rename a file with a special character?

    - by codeLes
    I have a song that Windows can't play because there is a question mark in the name of the file. "Where Have All the Cowboys Gone?.ogg" // as an example So I try to rename it and Windows complains whether I try it in Explorer or from command prompt. Error I get when trying to copy, rename, or move is: The Filename, directory name, or volume label syntax is incorrect Is there a Windows way to force a rename in this case? Update I'll keep an eye on this question, but after 13 answers and many attempts (aside form 3rd party solutions) it seems that Windows can't do this (or at least my windows can't, no short names). So I'm accepting the answer which was my original solution anyway of using Linux. It would be nice to see Windows handle this somehow, so don't stop just because I've accepted this answer, the question still stands!

    Read the article

  • smlnj rephrased question for listdir(filename, directoryname)

    - by czy1985
    i am a newbie learning sml and the question i am thrown with involves IO functions that i have no idea how it works even after reading it. Here is the 2 questions that i really need help with to get me started, please provide me with codings and some explaination, i will be able to trial and error with the code given for the other questions. Q1) listdir(filename,directoryname), which given the name of a directory, list its contents in a text file. The listing is in a form that makes it easy to seperate filenames, dates and sizes from each other. (similar to what msdos does with "dir" but instead of just listing it out, it places all the files and details into a text file. Q2) readlist(filename) which reads a list of filenames (each of which were produced by listdir in (Q1) and combines them into one large list. (reads from the text file in Q1 and then assigning the contents into 1 big list containing all the information) Thing is, i only learned from the lecturer in school on the introduction section, there isnt even a system input or output example shown, not even the "use file" function is taught. if anyone that knows sml sees this, please help. Thanks to anyone who took the effort helping me. Thanks for the reply, current I am using SMLNJ to try and do this. Basically, Q1 requires me to list the directory's files of the "directoryname" provided into a text file in "filename". The Q2 requires me to read from the "filename" text file and then place the contents into one large list. Duplicate of: smlnj listdir

    Read the article

  • Missing backslashes in filename using C#

    - by CL4NCY
    Hi, I have a string literal as follows: string filename = @"C:\myfolder\myfile.jpg"; When I use File.Exists(filename) it works most of the time but sometimes I get an error saying the following file doesn't exist: C:myfoldermyfile.jpg Something seems to strip the backslashes out of the filename. This code is sometimes accessed via an ajax request. Does anyone know why/how this could be happening? Edit: Here is a more detailed version of the code. public class Feeds { public static string ftpDir = @"C:\website\Feeds\"; } public class Feed { public static void run(string name) { if (!Directory.Exists(Feeds.ftpDir + name)){ Response.Write("Feed doesn't exist '" + Feeds.ftpDir + name + "'"); return; } //run feed... } }

    Read the article

  • Log4net appender filename issue

    - by JL
    I have an appender setup like this <appender name="Scheduler_Appender" type="log4net.Appender.RollingFileAppender"> <file value="c:\temp\ApplicationLog.txt"/> <rollingStyle value="Date"/> <datePattern value="yyyyMMdd"/> <appendToFile value="true"/> <staticLogFileName value="true"/> <layout type="MinLayout"> <locationInfo value="true"/> </layout> </appender> When the log file first gets created the file name is simply ApplicationLog.txt this is correct. However when the logging rolls - the filename that gets generated is ApplicationLog.txt20100323 (for example), and not ApplicationLog20100323.txt How can I change the configuration so files are rolled to [FileName][Date].[ext] rather than [FileName].[ext][Date] Thanks

    Read the article

  • getimagezise Error pasing filename

    - by Talha Bin Shakir
    Hi, I am using getimagesize() to get teh size of my image. I have image in my sub-directory when i am passing file name with sub-directory i ma facing an error: There is no such file or directory here is my Code: <?PHP function resize($img,$max_w){ $max_h=$max_w; list($img_w,$img_h) = getimagesize($img); $f = min($max_w/$img_w, $max_h/$img_h, 1); $w = round($f * $img_w); $h = round($f * $img_h); return array($w,$h); } $filename="user_img/"."1256115556.jpg"; $resize=resize($filename,667); $w=$resize[0]; $h=$resize[1]; ?> instead of this when i passing $filename="1256115556.jpg"; file from my main directory the function is running perfectly. So please help me, How to pass file with sub-directory.

    Read the article

  • django filefield return filename only in template

    - by John
    I've got a field in my model of type FileField. This gives me an object of type type File, which has the following method: File.name: The name of the file including the relative path from MEDIA_ROOT. What I want is something like .filename that will only give me the filename and not the path as well something like: {% for download in downloads %} <div class="download"> <div class="title">{{download.file.filename}}</div> </div> {% endfor %} which would give something like myfile.jpg thanks

    Read the article

  • mget: filename.xlsx: file already existst and xfer:clobber is unset

    - by Chris
    I am getting this: mget: filename.xlsx: file already existst and xfer:clobber is unset error when I try to download the contents of my ftp server. Basically it is setup using cygwin. We recently upgraded the server where all of the data is downloaded to on a set schedule. The old server was Windows server 2003, and the new server is windows server 2008. I am having issues when I try to download a file that is already in the folder. The client never changes the file name, so when we go to download it from the server we get that error. Is there anything i can put in the batch files, or something for it to just force it to replace that file? Thanks in advance

    Read the article

  • On Windows, what filename extensions denote an executable?

    - by Ken
    On Windows, *.exe, *.bat, *.cmd, and *.com all represent programs or shell scripts that can be run, simply by double-clicking them. Are there any other filename extensions that indicate a file is executable? EDIT: When I jump into a new project (or back into an old project!), one of the common things I want to do when looking around is to find out what tools there are. On Unix (which I've used for decades), there's an execute bit, so this is as simple as: find . -executable -type f I figured that on Windows, which seems to have a much more complex mechanism for "is this executable (and how do I execute it)", there would be a relatively small number of file name extensions which would serve roughly the same purpose. For my current project, *.exe *.bat *.cmd is almost certainly sufficient, but I figured I'd ask if there was an authoritative list.

    Read the article

  • Get tortoisesvn to give me filenames with build number in the filename

    - by EricJLN
    I am on a Windows 7 box, and I have tortoisesvn on my machine. After getting a little familiar with svn and tortoisesvn on a code repository, I set up a local repository to manage revisions of some word and powerpoint documents. I want to figure out some scripted way to output a set of files with the build/revision number embedded in the filename. I will then email the files to some business people to review. For example, say I have a group of files in my working directory: PresentA.pptx PresentA-notes.docx PresentB.pptx and TortoiseSVN repo browser tells me that I am currently at revision 21 for PresentA.pptx and PresentA-notes.docx but at revision 25 for PresentB.pptx, I would like some way to get 3 files with the following names: PresentA-r21.pptx PresentA-notes-r21.docx PresentB-r25.pptx Alternatively, if revision 25 is the current value for the repository, having all the names appended with -r25 would work, too.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >