File uploading sucks!
このコミットが含まれているのは:
コミット
50a54fb294
|
@ -441,74 +441,31 @@ class StoreController extends Controller {
|
||||||
->count();
|
->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function moveFile($directory, $name = null) {
|
public function makedir(Request $request) {
|
||||||
//if ($this->)
|
$id = $request->id;
|
||||||
}
|
|
||||||
|
|
||||||
public function uploadEntry(Request $request) { // /api/rpc/store/entry/upload
|
if (!mkdir($this->storePath.'/'.$id, 0755, true)) {
|
||||||
// Log::info('Res: '.$request);exit();
|
|
||||||
/* if (!mkdir($this->storePath.'/'.$request->id, 0755, true)) {
|
|
||||||
Log::error('File MKDIR failed: ');
|
Log::error('File MKDIR failed: ');
|
||||||
exit();
|
exit();
|
||||||
} */
|
}
|
||||||
|
|
||||||
if (!mkdir($this->storePath.'/'.$request->id.'/screens', 0755, true)) {
|
if (!mkdir($this->storePath.'/'.$id.'/screens', 0755, true)) {
|
||||||
Log::error('Asset MKDIR failed: ');
|
Log::error('Asset MKDIR failed: ');
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// foreach ($request->upfile as $f) {
|
public function uploadEntry(Request $request) { // /api/rpc/store/entry/upload
|
||||||
//Log::info('Name: '.gettype($f));exit();
|
header('Access-Control-Allow-Origin: *');
|
||||||
// $f->storeAs('store/'.$request->id, $f, 'public');exit();
|
$id = $request->id;
|
||||||
/* if ($f->storeAs('store/'.$request->id, $f, 'public')) {
|
|
||||||
Log::error('File store failed: ');
|
|
||||||
exit();
|
|
||||||
} */
|
|
||||||
// }
|
|
||||||
|
|
||||||
foreach ($request->file('imgfile') as $m) {
|
Log::info('Name: '.$request->file('imgfile')); //TMP
|
||||||
Log::info('Name: '.$m);
|
Log::info('Type: '.gettype($request->file('imgfile'))); // TMP
|
||||||
Log::info('Name: '.gettype('store/'.$request->id.'/screens'));
|
|
||||||
$m->move('store/'.$request->id.'/screens', $m->getClientOriginalName());
|
|
||||||
// $m->storeAs('store/'.$request->id.'/screens', $m, 'public');
|
|
||||||
// $m->store('store/'.$request->id.'/screens', 'public');
|
|
||||||
// if ($m->storeAs('store/'.$request->id.'/screens', $m, 'public')) {
|
|
||||||
// Log::error('Asset store failed: ');
|
|
||||||
// exit();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
exit();
|
|
||||||
|
|
||||||
/* foreach ($_FILES['fileupload']['tmp_name'] as $key => $files) {
|
$request->file('upfile')->move(public_path('storage/store'.$id), $request->file('imgfile')->getClientOriginalName);
|
||||||
if (!empty($_FILES['fileupload']['name'][$key])) {
|
$request->file('imgfile')->move(public_path('storage/store'.$id.'/screens'), $request->file('imgfile')->getClientOriginalName);
|
||||||
$file_name = $_FILES['fileupload']['name'][$key];
|
|
||||||
$file_tmp = $_FILES['fileupload']['tmp_name'][$key];
|
|
||||||
|
|
||||||
if (!move_uploaded_file($file_tmp, $this->storePath.'/'.$request->id.'/'.$file_name)) {
|
exit(); // TMP
|
||||||
$error = $error = error_get_last();
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($_FILES['imageupload']['tmp_name'] as $key => $screens) {
|
|
||||||
if (!empty($_FILES['imageupload']['name'][$key])) {
|
|
||||||
$file_name = $_FILES['imageupload']['name'][$key];
|
|
||||||
$file_tmp = $_FILES['imageupload']['tmp_name'][$key];
|
|
||||||
|
|
||||||
if (!move_uploaded_file($file_tmp, $this->storePath.'/'.$request->id.'/screens/'.$file_name)) {
|
|
||||||
$error = $error = error_get_last();
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
$kage = $key+1;
|
|
||||||
|
|
||||||
if (!rename($this->storePath.'/'.$request->id.'/screens/'.$file_name, $this->storePath.'/'.$request->id.'/screens/'.$kage.'.png')) {
|
|
||||||
$error = $error = error_get_last();
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
$add = DB::table('str_file')
|
$add = DB::table('str_file')
|
||||||
->insert([
|
->insert([
|
||||||
|
|
|
@ -105,7 +105,8 @@ export default {
|
||||||
path: this.pwd,
|
path: this.pwd,
|
||||||
command: ''
|
command: ''
|
||||||
}],
|
}],
|
||||||
result: []
|
result: [],
|
||||||
|
group: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
|
@ -157,6 +158,12 @@ export default {
|
||||||
path: this.pwd,
|
path: this.pwd,
|
||||||
command: ''
|
command: ''
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.group.push([
|
||||||
|
this.line,
|
||||||
|
this.result
|
||||||
|
]);
|
||||||
|
console.log(this.group);
|
||||||
},
|
},
|
||||||
ls(pwd) {
|
ls(pwd) {
|
||||||
var neopwd = pwd.replace('/', 'sl');
|
var neopwd = pwd.replace('/', 'sl');
|
||||||
|
|
|
@ -52,6 +52,7 @@ Route::get('/api/rpc/store/entry/getentryname/{id}', 'StoreController@getEntryNa
|
||||||
Route::get('/api/rpc/store/entry/getentriesincategory/{cat_id}', 'StoreController@getEntriesInCategory');
|
Route::get('/api/rpc/store/entry/getentriesincategory/{cat_id}', 'StoreController@getEntriesInCategory');
|
||||||
Route::get('/api/rpc/store/entry/countentriesincategory/{cat_id}', 'StoreController@countEntriesInCategory');
|
Route::get('/api/rpc/store/entry/countentriesincategory/{cat_id}', 'StoreController@countEntriesInCategory');
|
||||||
Route::get('/api/rpc/store/entry/countentriesincategoryfull/{cat_id}', 'StoreController@countEntriesInCategoryFull');
|
Route::get('/api/rpc/store/entry/countentriesincategoryfull/{cat_id}', 'StoreController@countEntriesInCategoryFull');
|
||||||
|
Route::post('/api/rpc/store/entry/makedir', 'StoreController@makedir');
|
||||||
Route::post('/api/rpc/store/entry/upload', 'StoreController@uploadEntry');
|
Route::post('/api/rpc/store/entry/upload', 'StoreController@uploadEntry');
|
||||||
Route::post('/api/rpc/store/entry/update', 'StoreController@updateEntry');
|
Route::post('/api/rpc/store/entry/update', 'StoreController@updateEntry');
|
||||||
Route::post('/api/rpc/store/entry/restore', 'StoreController@restoreEntry');
|
Route::post('/api/rpc/store/entry/restore', 'StoreController@restoreEntry');
|
||||||
|
|
新しいイシューから参照