dbr.upload - increment image name - File image.jpg already exists

(6 posts) (2 voices)

Tags:

No tags yet.

  1. maron, Member

    Hello.

    I have a report which I want to use an iphone to add an image to, via dbr.upload.

    However, I always get image.jpg exists after inserting the first image, how can I create an incremental counter on images with the same name so they don't overlap.

    I did try this in the upload procedure but it didn't work

    set in_file = concat(in_id, DATE_FORMAT(NOW(), '-%Y-%m-%d-%H-%i-%s-'), in_file);

  2. myDBR Team, Key Master

    There is an option, add_time, that you can use for this exact purpose.

    --
    myDBR Team

  3. maron, Member

    The add_time works fine when adding images from the photo library on ios. However when taking pictures directly into the form (an option in ios) it doesn't add the time, and the name is always image.jpg.

    On a sidenote it would be great if we could have copy paste support into the upload field as well, meaning, we could paste img data from clipboard (for example screenshots) - this would greatly enhance the current use case where we are using various data sources for inspection purposes, some are online and sometimes we have to go on site to photograph.

  4. myDBR Team, Key Master

    How does your form/report look like?

    --
    myDBR Team

  5. maron, Member


    declare _action varchar(45); if json_valid(inJson) and inJson ->> '$.action' is not null then
    set _action = inJson ->> '$.action';
    else
    set _action = '';
    end if; if _action = '' then select 'dbr.pageview';
    select inUUID as "uuid:"; -- Upload image to server side files
    select 'dbr.upload.options', 'noreplace', 1;
    select 'dbr.upload.options', 'add_time', 1;
    select 'dbr.upload.options', 'accepted_files', '.jpg,.jpeg,.png';
    select 'dbr.upload.options', 'title', 'Click here to upload node image';
    select 'dbr.upload','/path/to/dbr/user/MapImages','sp_DBR_upload_file', inUUID;
    select 'dummy'; select 'dbr.report', 'sp_DBR_nodes_history', '[form_action]', 'inJson=p_json';
    select 'dbr.form', 'json', 'inPostJson'; select 'dbr.form', 'start', 'my_form'; -- The form starts here
    select 'form_action', json_object(
    'uuid',
    inUUID,
    'action',
    'new_history'
    ) as p_json; select 'dbr.form', 'textarea', 'descr', 'Description:';
    select 'dummy'; select 'dbr.form', 'submit', 'Add new Node History';
    select 'dbr.form', 'end'; -- The form ends here
    select 'dummy'; elseif _action = 'new_history' then set @uuid = inJson ->> "$.uuid";
    set @in_descr = inPostJson ->> "$.in_descr"; select
    description into @is_descr_empty
    from AhaInfo.nodes_description
    where uuid = @uuid; if @is_descr_empty is null then
    update AhaInfo.nodes_description
    set description = CONCAT('[\"', REPLACE(@in_descr, 'user/', ''), '\"]')
    where uuid = @uuid;
    else
    update AhaInfo.nodes_description
    set description = CONCAT('[\"', replace(@in_descr, 'user/', ''), '\",', SUBSTRING(description, 2))
    where uuid = @uuid;
    end if; select 'dbr.text', 'History for node successfully added.';
    select 'dbr.text', ''; select 'dbr.pageview';
    select
    *
    from AhaInfo.nodes_description
    where uuid = @uuid; -- select 'dbr.report', 'sp_DBR_merchant_home_page', 'inJson=p_json';
    -- select 'dbr.button', 'Home Page';
    -- select json_object(
    -- 'action', ''
    -- ) as p_json; end if;

  6. myDBR Team, Key Master

    Thanks,
    we'll take a look at it.

    --
    myDBR Team


Reply

You must log in to post.