Opened 16 years ago

Closed 11 years ago

Last modified 10 years ago

#2989 closed Feature request (fixed)

Create new file on server

Reported by: heatherw_01 Owned by: Luc
Priority: normal Component: FileZilla Client
Keywords: create new file Cc: heatherw_01, Tim Kosse, Alexander Schuch, NightKev@…, ngkongs@…
Component version: Operating system type:
Operating system version:

Description

It would be nice to be able to create a file on the server that you are connected to, instead of having to create the file locally and upload

Attachments (2)

diff-rup.patch (5.8 KB ) - added by Luc 12 years ago.
diff -rup as suggested by @hejazee (comment 26)
svndiff.txt (5.4 KB ) - added by Luc 12 years ago.

Download all attachments as: .zip

Change History (41)

comment:1 by Tim Kosse, 16 years ago

Only thing it could do is creating 0 size files, what's the point in that?

comment:2 by heatherw_01, 16 years ago

You can do it with Flashfxp and smartftp. You create a new file and then edit in on the server

comment:3 by Will Anderson, 15 years ago

Seems this is pretty old but its what I found when I searched for tickets on this.

I too wish that there was a way to create files directly with FileZilla.

I use FileZilla mainly to update web sites (where 75% of the time I'm creating new content). The current process I use is:

  1. Drag a (random) file from my local machine to the host machine to upload it.
  2. Rename the file to what I actually want it to be called.
  3. Edit the file and upload the new content to the website.

I understand that I could simply open Windows Explorer and create the new file there, but that would require even more steps to navigate to a good folder, create the file, navigate to said folder in FileZilla, upload file to server. I feel that being able to create new files on the server would remove the need to follow either of these processes. Here's what I had in mind:

  1. Right click on the host pane and select "New File..."
  2. A dialog will appear where the user enters the name of the new file to be created.
  3. A temporary file of the same name is created in FileZilla's default Temp directory.
  4. Depending on the file type specified, the file is opened in the editor defined by the user.
  5. When the user saves changes to the file, FileZilla can upload it to the server (essentially, after the temp file is created and the editor is opened, the process is the same as the already existing "Edit" functionality).

Anyway, sorry for the rather long winded comment, but it seemed like this feature request hadn't been described well enough to get the idea across.

comment:4 by mattm591, 15 years ago

I also would have need for this.

I am frequently setting people up with Google Webmaster Tools.

To verify ownership of a site you have to create a file on the server (which can be 0 byte) with a certain name.

Currently I create it locally as an empty text file then upload it. Being able to create it directly on the server would save time.

comment:5 by nmrugg, 14 years ago

+1
I just wanted to say that I would really like this feature too.

comment:6 by Michael Finney, 14 years ago

I would like this feature as well. It's really the only thing that bugs me about FileZilla as most other FTP programs can do this.

It is useful in situations when I work on a development server that does not have samba installed. Especially if I'm working with server-side scripting.

Most of the time I have to ssh to the server and create files in the terminal and then use FileZilla to edit them.

comment:7 by Michael, 14 years ago

+2.

I too am forced to drag a random file to my server, rename it to what I actually want, and then clear it.

Please filezilla gods! It would REALLY make filezilla the ultimate FTP client.

comment:8 by Kevin, 14 years ago

Cc: NightKev@… added

I must say, it's really annoying having to browse to a blank file on my computer so I can then upload -> rename -> edit it. It may not seem like that much time to do so, but it adds up, especially if you're doing it rather often. So, can we please have this?

comment:9 by RunAwayScientist, 14 years ago

I too would love to see this feature on Filezilla.

comment:10 by Matt Nelly, 14 years ago

Priority: normalhigh

I see this ticket is quite old but I would like to provide my support for it. Creating one or two new files on the server isn't a big deal (drag random and rename), but when you need to make a good handful of them, it would be soooo much easier to have the right click...new empty file.

I think this should be a high priority item because it's really a small feature, and shouldn't take long at all to implement.

comment:11 by William Sutanto, 14 years ago

Cc: ngkongs@… added

+1

i beg you to consider this feature to be implemented :)

comment:12 by pushka ben, 13 years ago

Keywords: create new file on server file zilla new blank added
Operating system type: OS X
Operating system version: Snow Leopard
Priority: highcritical

Please add this basic function.

To create a new HTML page etc. I need to create a new file on my computer (and I have a mac, so I can't press right click->new file)

Please add this when right clicking on an empty space in the server window of FileZilla:
"Create Directory
Create File
Refresh"

It would be the most easy thing to implement... and you could add a settings check box to turn off the function, if there were some crazy people that don't want this option...

This rant was brought to you by PushkaCom

comment:13 by Luc, 13 years ago

Operating system type: OS X
Operating system version: Snow Leopard

This is a gigantic lack. Filezilla is awesome, but this really needs to get done. The client should be able to simply create empty files on the server. Even FireFTP, the firefox' ftp addon, can do this...

Now I have to rename a file in the local directory (most often directories are identical local and remote), upload it, and then rename it on two places again (local back and remote to the right name).

(changed the OS and OSVersion to blank, why would this only be needed in OSX snow leopard -.- For me it's important in windows, probably someone else linux... just everywhere)

comment:14 by BurninLeo, 13 years ago

No more to say than +1, please add.

comment:15 by Dan, 13 years ago

+1

We can 'create directory'.

We should 'create file' also. It could be the same kind of dialog as with 'create directory', and would create a blank 0 byte file with default permissions.

..or even 'duplicate file' on the context menu of a file. It could be the same kind of dialog as with 'create directory'. It would download the file in the tmp folder and reupload the file (because FTP protocol doesn't allow direct copy, unlike SSH) with same permissions as the original. ... and why not 'duplicate folder'.
(maybe that should go in a separate ticket)

comment:16 by Ahmad, 12 years ago

+1

comment:17 by alanchau, 12 years ago

+1

comment:18 by Kevin, 12 years ago

Holy shit, why is this still not done after FOUR ENTIRE YEARS?! Do the people that contribute code to Filezilla not even use it at all? Is no one even developing this anymore? We need a priority higher than critical, apparently.

comment:19 by Alexander Schuch, 12 years ago

Keywords: on server zilla blank removed
Priority: criticalnormal

comment:20 by Luc, 12 years ago

Priority: normalhigh

I really do find this a high priority issue, given how much work it is to implement and how annoying it is to upload random small files every time.

comment:21 by Ahmad, 12 years ago

I think it should be a menu like the "New" menu in windows explorer
And when the user clicks, for example, "New Text Document",
Filezilla should create a new text document in the temp folder and then upload it to the server.

All the other menu items should be also available:
1 - New Word document
2 - New Microsoft powerpoint
etc

That helps the user to create some customized template in windows explorer and use them in filezilla. The user may want to create some templates like:
New HTML document
New PHP file
New Smarty template
etc...
And he will be able to use these templates in filezilla as well as windows explorer.

comment:22 by Luc, 12 years ago

Owner: set to Luc
Status: newaccepted

@hejazee Very good idea.

I'm currently working on this (after trying for an hour to get it to compile - it's got more dependencies than advertised!), but it's the first time I try anything besides basic arithmetic in C++. It's *probably* of my reach at the moment to do anything besides a basic menu option to create an empty file on the server, which imo is already a big improvement to the current state.

In fact I'm so happy to get this dialog to show that I screenshotted it :D http://g2f.nl/0vyivfi.png
(For now it just discards the entered filename though.)

I'll continue tomorrow (3am here) and keep you guys posted. Don't hesitate to implement it before I am able to finish it though, it's about the end result that matters!

comment:23 by Luc, 12 years ago

I've finished implementing it. What it does:

  • If you are connected to a server and rightclick in the remote file listing on either blank space, a file, or a directory, the menu will show "Create new file" below the existing "Create directory". Rightclicking when not connected makes it greyed out.
  • If you rightclicked a directory, the file will be made in the current directory (not in the one you rightclicked). Not sure if this is a good idea...
  • When you click the option to create a new file, a dialog pops up, prompting for the filename, just like the create-directory option does.
  • It checks whether the filename already exists and if it contains invalid characters (anything that Windows deems invalid; I don't check whether it's a windows or unix server; you can always use rename on it afterwards).
  • An empty file named "empty_file_yq744zm" is created in the temporary folder (e.g. /tmp/fz3temp-1) and scheduled in the transfer queue, after which the queue is initiated. Any other files that were already in the queue and shouldn't be processed will not be transferred. When transferring, it will use the right target name already, so it doesn't rename afterwards. It's not checked whether "empty_file_yq744zm" already existed in the temporary folder, but I don't think this will ever cause problems.
  • When closing Filezilla, the temporary file is deleted (together with the lockfile).

I've tested on Linux only, cross-compiling doesn't work (the instructions are not correct, gnuTLS misses idna.h from libidn, even though libidn is installed with the command as instructed). I'll be looking into how I'm supposed to push the updated sourcecode today or tomorrow, for now I'll share a zip for those who want to test, review and improve (please do!).

The modified source files and a diff so you can see what's changed: http://g2f.nl/0sde6qp.zip (32KB)
Linux binaries on request.

Let me know what you think! Also if anyone can tell me how I should distribute the updated sources, that'd save me a search :)

comment:24 by Tim Kosse, 12 years ago

Status: acceptedmoreinfo_accepted

@lucb1e: Please attach the patch in form of a unified context diff against trunk in the SVN repository and mark the ticket as patch. Don't hide the file inside of an archive, that only makes the patch somewhat inaccessible and causes extra work.

comment:25 by Luc, 12 years ago

Status: moreinfo_acceptedaccepted
Type: Feature requestPatch

@codesquid Googling for a context diff against the trunk, I found this command:
$ svn diff fz-svn fz-new > svndiff.txt

The output is attached. Is this what you mean?

I've been looking in the faq, wiki, forums and asked on irc yesterday, but couldn't find anything on how to submit patches (though I was on irc for only 25 minutes). Perhaps something to add to the faq? It seems Apache and wxWidgets have guides for this (which is where I found the command to use, though the suggested -u and -c options didn't work with svn diff - not sure if those are needed, the patch looks okay to me).

comment:26 by Ahmad, 12 years ago

I haven't worked with svn, But I have tried git.
I guess you should get the diff by this command:

diff -rup file-old file-new > result.patch

And then you can apply a patch file By this command:

patch Original-File Patch-File.patch

by Luc, 12 years ago

Attachment: diff-rup.patch added

diff -rup as suggested by @hejazee (comment 26)

comment:27 by Tim Kosse, 12 years ago

Status: acceptedmoreinfo_accepted

Overall the patch looks good, though there are a few details that probably need to be solved:

1) The used mnemonic in "Cre&ate new file" conflicts with "&Add files to queue".

2) Using fopen in combination with wxConvUTF8 doesn't work on Windows. Windows uses a different encoding. In particular, many non-English users have non-ASCII characters in their home directory name. Better use wxFile here which takes care of proper conversion. Whole point might be obsolete though due to the previous point.

3) Some commented out code at the end of OnMenuNewfile

comment:28 by Tim Kosse, 12 years ago

Whole point might be obsolete though due to the previous point.

Please forget that sentence, it's obsolete.

in reply to:  28 comment:29 by Luc, 12 years ago

Fixed 1 and 3, but not sure what you mean by 2. The local filename (used in fopen) is hardcoded, so that can't cause any problems. The target filename is checked for some invalid characters (copied the list from elsewhere in the filezilla source). If the server's filesystem doesn't support the filename, it should just reject the transfer (or error when storing) and the transfer goes into Failed Transfers.

comment:30 by Tim Kosse, 12 years ago

fopen takes the filename in a locale-specific encoding. Only on some systems and locales it is UTF-8. On a German Windows for example it is instead ISO-8859-1.

The full name consists of both the filename and the full path to it. It's the path that can contain non-ASCII characters.

Thus, passing the full name encoded as UTF-8 to fopen, when instead some other encoding should have been used, won't work. You need to use the system-specific locale. To make things easy, simply use wxFile.

comment:31 by Luc, 12 years ago

I see. Updated the patch, is this the way it should be? By the way, thanks for taking the time to check the patch and explain to me ;)

comment:32 by Tim Kosse, 12 years ago

You've introduced a memory leak, allocating wxFile on the heap but never freeing it. Why not allocate it on the stack?

Also, wxString::Append modifies the object it is called on. emptyfile and emptyfile_path are identical.

comment:33 by Luc, 12 years ago

Oh great, guess C++ is more complicated than it seemed lol. Seems the + operator simply works on the wxstrings so Append is useless here. For the memory leak, I thought anything created in the function would free as soon as the function finished... Hmm so that what the GC does in C#, PHP, etc.?

Updated the patch. Instead of appending, it now does:
wxString emptyfile = emptyfile_path + emptyfile_name;

And after new wxFile(); and wxfile->create, I have: free(wxfile);

comment:34 by Tim Kosse, 12 years ago

Not quite. What you allocate with 'new' can only be freed using 'delete'. 'free' on the other hand is the opposite of 'malloc', both 'malloc' and 'free' are remnants from C.

In this case, you can simply allocate wxFile on the stack:

wxFile file;
file.Create(emptyfile);

by Luc, 12 years ago

Attachment: svndiff.txt added

comment:35 by Tim Kosse, 12 years ago

Resolution: fixed
Status: moreinfo_acceptedclosed

Thanks, I've applied and committed your patch.

Three small changes:

  • Creating two files printed an ugly error message. To suppress it, file creation has been moved inside the scope of a wxLogNull instance.
  • Made enabled/disabled state context menu entry for Create File behave exactly as Create Directory.
  • Bypass the transfer queue and execute the transfer command on the browsing connection.

comment:36 by rnoble05, 11 years ago

Resolution: fixed
Status: closedreopened

Not sure if you ever found out how to easily create new file on server: however its pretty simple just login to your remote access, navigate to where you want the file created at, and right click on new directory, change the path from new directory to whatever you want the file name to consist of. Make sure it successfully uploads to the server, hope it helps.

comment:37 by Ahmad, 11 years ago

Thanks
But, I think it would be better if there was an option to create "file templates"
as I mentioned in this comment:
http://trac.filezilla-project.org/ticket/2989#comment:21

comment:38 by Alexander Schuch, 11 years ago

Priority: highnormal
Type: PatchFeature request

comment:39 by Alexander Schuch, 11 years ago

Resolution: fixed
Status: reopenedclosed

I created a follow up feature request for the OS-specific new file facility in #8707.

This one is implemented now.

Note: See TracTickets for help on using tickets.