# MBS CURL Plugin FTP changing filename

**URL:** <https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934>\
**Category:** macOS\
**Created:** [April 10, 2024, 4:31pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934 "2024-04-10T16:31:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Sweeney](https://forum.xojo.com/user_avatar/forum.xojo.com/mark_sweeney/32/3332_2.png) [@Mark\_Sweeney](https://forum.xojo.com/u/Mark_Sweeney)\
**Post date:** [April 10, 2024, 4:31pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/1 "2024-04-10T16:31:34Z")

</div>

I’m using the “CURLS ftp file upload direct” example, and while it uploads the file to the ftp server, the name of the file gets changed from “something.zip” to  
OptionUsername.

If I change the name back on the ftp, and add .zip extension, the file works.

I’ve tried other ftp Curl examples, and they all do the same thing - the file gets uploaded, but with the user name as the file name

```auto
dim d as new UploadCURL

if d.OpenMTInputFile(f) then
  // ok
else
  MsgBox "Failed to open file."
  Return
End If

d.OptionURL = url.Text
d.OptionUpload = True
d.OptionVerbose = true // generate messages
d.CollectDebugMessages = true // collect them

d.OptionUsername = "the_user_name"
d.OptionPassword = "00000-00000-00000"
d.OptionSSHAuthTypes = 2+8 // for SFTP: only allow keyboard or interactive login, no public key

dim e as integer = d.Perform

dim DebugMessages as string = d.DebugMessages
// check those in debugger in case of errors

listbox1.addrow "Result: "+str(e)

if e <> 0 then
  break
end if

```

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [April 10, 2024, 4:47pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/2 "2024-04-10T16:47:39Z")

</div>

The file name on the server goes into the URL.  
Don’t forget to use EncodeURLComponent() for this.

e.g.

`d.OptionURL = "ftp://test.server.com/folder/" + EncodeURLComponent(filename)`

d.CollectDebugMessages and d.OptionVerbose are now on by default, so the lines are no longer needed.

---

<div class="post-metadata">

**Author:** ![Mark\_Sweeney](https://forum.xojo.com/user_avatar/forum.xojo.com/mark_sweeney/32/3332_2.png) [@Mark\_Sweeney](https://forum.xojo.com/u/Mark_Sweeney)\
**Post date:** [April 10, 2024, 5:14pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/3 "2024-04-10T17:14:10Z")

</div>

With filename “TestFile.zip” and username “Doug\_Adams” and ftp “ftp://myserver.com/Doug\_Adams”, I’m getting a file name of “Doug\_AdamsTestFile.zip”

if I use “ftp://myserver.com/Doug\_Adams/” I get an error result 9.

---

<div class="post-metadata">

**Author:** ![AlbertoD](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/dbc845/32.png) [@AlbertoD](https://forum.xojo.com/u/AlbertoD)\
**Post date:** [April 10, 2024, 5:26pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/4 "2024-04-10T17:26:32Z")

</div>

Error 9 may be ‘Server denied you to change to the given directory’  
Do you have Doug\_Adams folder?  
Do you have the rights to read/write to it?

Note: if you are connecting as the user maybe the path is relative to the user’s default dir.

---

<div class="post-metadata">

**Author:** ![Christian\_Schmitz](https://forum.xojo.com/user_avatar/forum.xojo.com/christian_schmitz/32/158_2.png) [@Christian\_Schmitz](https://forum.xojo.com/u/Christian_Schmitz)\
**Post date:** [April 10, 2024, 6:17pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/5 "2024-04-10T18:17:20Z")

</div>

Leave the Doug\_Adams part away.  
You are probably already in that folder.

---

<div class="post-metadata">

**Author:** ![Mark\_Sweeney](https://forum.xojo.com/user_avatar/forum.xojo.com/mark_sweeney/32/3332_2.png) [@Mark\_Sweeney](https://forum.xojo.com/u/Mark_Sweeney)\
**Post date:** [April 10, 2024, 6:43pm UTC](https://forum.xojo.com/t/mbs-curl-plugin-ftp-changing-filename/79934/6 "2024-04-10T18:43:10Z")

</div>

That’s a Bingo! Thanks Christian!
