Виктор Шейко 4 سال پیش
والد
کامیت
68f29fbdca

+ 4 - 5
Assets/Scripts/Controllers/FileBrowserController.cs

@@ -87,8 +87,6 @@ public class FileBrowserController : MonoBehaviour, IPointerDownHandler
         }
     }
 
-
-
     private IEnumerator OutputRoutine(string url)
     {
         //var loader = new WWW(url);
@@ -162,8 +160,9 @@ public class FileBrowserController : MonoBehaviour, IPointerDownHandler
         else
         {
             file_name = Path.GetFileName(url);
-            form.AddBinaryData("file", File.ReadAllBytes(url), file_name);
-            www = UnityWebRequest.Post($"http://dev.prmsys.net/areditortest/StreamingAssets/upload.php", form);
+            var bytes = File.ReadAllBytes(url);
+            form.AddBinaryData("file", bytes, file_name);
+            www = UnityWebRequest.Post($"http://dev.prmsys.net/positionviewer/StreamingAssets/upload.php", form);
         }
         yield return www.SendWebRequest();
         if (www.isHttpError)
@@ -171,7 +170,7 @@ public class FileBrowserController : MonoBehaviour, IPointerDownHandler
         else
         {
             Debug.Log("Uploaded");
-            inputField.text = $"{Application.streamingAssetsPath}/Targets/{file_name}";
+            inputField.text = $"{Application.streamingAssetsPath}/{file_name}";
         }
         Debug.Log(www.downloadHandler.text);
     }

+ 8 - 0
Assets/StreamingAssets.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 8f675c08fc3ca554182684b0d876d487
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 12 - 0
Assets/StreamingAssets/Upload.php

@@ -0,0 +1,12 @@
+<?php
+     $file = $_FILES["file"];
+ 
+     if (!empty($file)){
+         echo "Got file";   
+   
+      move_uploaded_file($file['tmp_name'], "./" . $file['name']);
+      
+     }
+     else
+         echo "Failed to get File";
+ ?>

+ 7 - 0
Assets/StreamingAssets/Upload.php.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 1336379c2cc73774a9af3d1b813e2250
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: