Ticket #2989 (closed Feature request: fixed)

Opened 6 years ago

Last modified 7 months ago

Create new file on server

Reported by: heatherw_01 Owned by: lucb1e
Priority: normal Component: FileZilla Client
Keywords: create new file Cc: heatherw_01, codesquid, ci-dev, NightKev@…, ngkongs@…
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

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

Change History

  Changed 6 years ago by codesquid

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

  Changed 6 years ago by heatherw_01

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

  Changed 6 years ago by anderswc

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.

  Changed 5 years ago by mattm591

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.

  Changed 5 years ago by nmrugg

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

  Changed 5 years ago by mfinney

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.

  Changed 5 years ago by michael2572

+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.

  Changed 5 years ago by NightKev

  • 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?

  Changed 5 years ago by RunAwayScientist

I too would love to see this feature on Filezilla.

  Changed 4 years ago by MattNelly

  • priority changed from normal to high

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.

  Changed 4 years ago by ngkong

  • cc ngkongs@… added

+1

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

  Changed 4 years ago by pushka

  • priority changed from high to critical
  • os_version set to Snow Leopard
  • os set to OS X
  • keywords create new file on server file zilla new blank added

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

  Changed 4 years ago by lucb1e

  • os_version Snow Leopard deleted
  • os OS X deleted

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)

  Changed 4 years ago by BurninLeo

No more to say than +1, please add.

  Changed 3 years ago by kamidan

+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)

  Changed 2 years ago by hejazee

+1

  Changed 2 years ago by alanchau

+1

  Changed 2 years ago by NightKev

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.

  Changed 2 years ago by ci-dev

  • priority changed from critical to normal
  • keywords on server zilla blank removed

  Changed 2 years ago by lucb1e

  • priority changed from normal to high

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.

  Changed 2 years ago by hejazee

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.

  Changed 2 years ago by lucb1e

  • owner set to lucb1e
  • status changed from new to accepted

@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!

  Changed 2 years ago by lucb1e

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 :)

  Changed 2 years ago by codesquid

  • status changed from accepted to moreinfo_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.

  Changed 2 years ago by lucb1e

  • status changed from moreinfo_accepted to accepted
  • type changed from Feature request to Patch

@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).

  Changed 2 years ago by hejazee

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

Changed 2 years ago by lucb1e

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

  Changed 2 years ago by codesquid

  • status changed from accepted to moreinfo_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

follow-up: ↓ 29   Changed 2 years ago by codesquid

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

Please forget that sentence, it's obsolete.

in reply to: ↑ 28   Changed 2 years ago by lucb1e

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.

  Changed 2 years ago by codesquid

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.

  Changed 2 years ago by lucb1e

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 ;)

  Changed 2 years ago by codesquid

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.

  Changed 2 years ago by lucb1e

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);

  Changed 2 years ago by codesquid

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);

Changed 2 years ago by lucb1e

  Changed 2 years ago by codesquid

  • status changed from moreinfo_accepted to closed
  • resolution set to fixed

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.

  Changed 23 months ago by rnoble05

  • status changed from closed to reopened
  • resolution fixed deleted

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.

  Changed 23 months ago by hejazee

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

  Changed 23 months ago by ci-dev

  • priority changed from high to normal
  • type changed from Patch to Feature request

  Changed 16 months ago by ci-dev

  • status changed from reopened to closed
  • resolution set to fixed

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.