-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Saving the uploaded file to a permanent location, not working on mobile devices. #199
Comments
Hi! It looks like the mobile device did not send the file. Did you try from a different browser or device ? On a separate note: it looks like you are saving temporary file paths in a permanent store (the database). Are you sure this is really what you want to do? You probably want to save files in a persistent location, where they won't be automatically deleted, and save that permanent path in the database. |
Hi @lovasoa, Hope you are well.
Thanks for the advice. So I have tested on 3 mobile devices, and 3 different browsers. Safari (iPhone) Chrome (Android) Firefox (Android) On the first Android device I have cleared cache and cookies, made sure that Chrome has all the permissions, I just cant see why it would not upload the images. I confirmed that both android devices chrome version is the same. Can you maybe think of a reason why the images did not upload? |
I have moved my file first and then inserted the path into the database. It has moved the file to a persistent location, but it inserted the temp file location in the DB, am I missing something? Code:
|
You are saving the What you can do is SET image1_path = sqlpage.uploaded_file_path('reg_img');
SET target_file_path = 'C:\SQLPage\Jobcard_Images/' || sqlpage.random_string(16) || '.jpg';
SET exec_image = sqlpage.exec('cmd','/C','move', $image1_path, $target_file_path);
INSERT INTO Images (JC_num, file_path, title)
VALUES($, $target_file_path, 'reg_no'); |
Perfect, that answers alot of questions. Thank you for your time. |
Hi @lovasoa, I was just wondering why the images did not upload using chrome on my mobile device. |
I haven't been able to reproduce your issue. Maybe you can share an small sample application that reliably reproduces the issue ? Or a network capture from the mobile device showing the issue ? |
@Pieter3033 : actually, thinking about this, I guess you are not testing with the exact same file from the different devices, are you ? Isn't it possible that you simply tried with files larger than your configured Did you have a look at SQLPage's logs ? Do they contain a line saying |
v0.20.1 adds a function that should make your life easier: https://sql.ophir.dev/functions.sql?function=persist_uploaded_file#function and it doesn't silently ignore large files |
Hi @lovasoa, trust you are well. With the new update I know exactly what the problem is, it was not an error with the browser nor the device being used. I did not know at the time but the You are correct, I did not test with the same files every time. The solution I found is to download an app that automatically lessens the image size. SQLPage |
Great, and thank you again for bringing this to my attention. In the end, we made SQLPage better and easier to use for everyone. |
Hi all,
sqlpage.uploaded_file_path
ReturningNULL
when submitting on a mobile device.On computer:
Works perfectly fine, file path is inserted into database.
Code:
Results: (Reference from DB)
On Mobile device:
Using the exact same code to save the image locally.
The file path just returns as NULL.
Reference from DB:
To Reproduce
file_path
to the database.The file_path will return as NULL.
The text was updated successfully, but these errors were encountered: