Ftp server upload error with uri

got an error when i submit my transer file

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Net;
using System.IO;
public class submitBug : MonoBehaviour
{
    public InputField _name;
    public Text _date;
    public InputField _whatDidHeDO;
    public InputField _whatHappend;
    string sendedText;
    string FTPHost = "192.168.0.122";
    string filepath;
    string FTPUsername = "mark";
    string FTPPassword = "";
    // Use this for initialization
    void Start()
    {

    }

    // Update is called once per frame
    public void Submit()
    {
        if (string.IsNullOrEmpty(_name.text) || string.IsNullOrEmpty(_whatDidHeDO.text) || string.IsNullOrEmpty(_whatHappend.text))
        {
            Debug.Log("fill everything in f8ot");
            return;
        }
        else
        {
            Debug.Log("uploaded :)");
            Upload();
            //submit here
            Debug.Log(Application.persistentDataPath);
        }
    }

    void Upload()
    {
        //upload
        string submidedBug = _name.text + ", " + _date.text + ", " + _whatDidHeDO.text + ", " + _whatHappend.text;
        System.IO.File.WriteAllText(Application.persistentDataPath + "/bugReport.txt", submidedBug);
        filepath = Application.persistentDataPath + "/bugReport.txt";


        WebClient client = new System.Net.WebClient();
        client.Credentials = new System.Net.NetworkCredential(FTPUsername, FTPPassword);
        Uri uri = new Uri(FTPHost + new FileInfo(filepath).Name);
        client.UploadFileAsync(uri, "STOR", filepath);
        Debug.Log(uri);
        //end uploading
    }
}

error:
UriFormatException: Invalid URI: The format of the URI could not be determined: 192.168.0.122bugReport.txt
System.Uri…ctor (System.String uriString, Boolean dontEscape)
System.Uri…ctor (System.String uriString)
submitBug.Upload () (at Assets/_scrips/submitBug.cs:52)
submitBug.Submit () (at Assets/_scrips/submitBug.cs:36)
UnityEngine.Events.InvokableCall.Invoke (System.Object[ ] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:153)
UnityEngine.Events.InvokableCallList.Invoke (System.Object[ ] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:634)
UnityEngine.Events.UnityEventBase.Invoke (System.Object[ ] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:769)
UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52)
UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269)
UnityEngine.EventSystems.EventSystem:Update()

192.168.0.122bugReport.txt isn’t a valid URL. At the very least, you’re missing a slash between the IP and the file name.

where sould i add the /?

here:

Uri uri = new Uri(FTPHost + new FileInfo(filepath).Name);

so +“/”+?

Frankly it sounds like you’re over your head on this because the answer is pretty plain and you’re also missing a protocol and it isn’t a Unity-specific question anyway. Maybe take a step back and read some documentation on System.Net.

The upshot is - your URL is no good. If you replaced 192.168.0.122 with your hard drive you’d get a path that looks like C:bugReport.txt. Can you tell what’s wrong with that?

that 192 stuff is from my local ftp server where i want to files to transfer too

I know - that wasn’t remotely my point…

ím ducth do i think im just not understanding your message

A URL is essentially a file path. You’re missing a / in your file path between the IP and the file name.

i know but where do i need add the /

like this?

Uri uri = new Uri(FTPHost +"/"+ new FileInfo(filepath).Name);

I dunno - did you try it? :slight_smile:

yes but same error

You’re still missing a protocol.

Again - this is pretty basic stuff and not Unity related. I think you’d be better off doing some independent research.